git status
git add .
git commit -am “Change default font from gerorgia leno”
git push – install

git config –global ‘Mike Hart’
git config –global ‘’

go to your project workspace = git init

git add index.html
git commit -am “commit message”
git diff
git add .

git –version
git status
git branch

git log = show changes
git log -p index.html
git blame css/main.css = show all people who have committed that file.


git branch branchname = makes a copy of workspace
git branch -av – show all branches
git checkout branchname
git branch -av – check

undo changes

git checkout — index.html // in master – get latest file
git reset –hard HEAD // in master – get all latest files

go back in time with reset

git log // to get commit id
git revert commitid
git reset –hard commitid

push code to github

editor settings check you can see git folder. include if excluded
git remote add origin https:// to .git file
go to config file edit [remote “origin”] [branch “master”] sections

to use without passwords google github ssh key

ignore files – dont want to see in commit

add .gitignore

clear file cache git rm -r –cached

In editor

escape :wq
q to get out

clone project from github

git clone newfolder

Git remote commands

git remote add github // crearte new origins
git remote rm github

//adds to git config file as a remote locations
git remote rename origin github
git remote show origin

git pull and git fetch

git pull origin master // pulls and merges
git fetch origin master // just pulls

Working Branch Demo

Create a new branch named “feature_x” and switch to it using

git checkout -b feature_x

You can check your git status tracking all the files

git status

Add all the files

git add -A

When you are ready to commit

git commit -m “Add comment about the work item you are commiting here”

Switch back to your local master branch and check there are no conflicts with the remote master branch. Then update your Local Master branch from Remote Master branch

git checkout master

git pull origin master

Merge the remote master branch with your local master branch

git merge feature_x

Send Skype message to team telling them you are about to commit to remote master branch

git push origin master:master

in both cases git tries to auto-merge changes. Unfortunately, this is not always possible and results in conflicts. You are responsible to merge those conflicts manually by editing the files shown by git. After changing, you need to mark them as merged with

git add -A

To delete a branch

git branch -d feature_x

git fetch
git checkout origin/master

Categories: Ajax