My notepad

Chris' IT notes…
← Back

GIT basic commands

Check branch

sh
git branch <name new branch>

Show changes after your last commit

sh
git diff

rollback to previous change (specific file) to the latest commit

sh
git checkout -- testfile

Delete branch

sh
git branch -D <branch name>

Push new branch to the origin (my 'git space')

sh
git push -u origin <branch name>

Restore file from upstream

sh
git checkout upstream/master -- <filename>

Commit changes in one single line

sh
git commit -a -m "comment"

If you want to merge the recent changes committed on the master branch into your dev branch

sh
git checkout dev      # gets you "on branch dev"
git fetch origin        # gets you up to date with origin
git merge origin/master

If you want to reset ALL from the version 'on the web'

sh
git fetch origin
git reset --hard origin/<branch>

Source: http://rogerdudler.github.io/git-guide/