- Show list of commits with hash:
git log
- Show file at revision:
git show REVISION:path/to/file
- Roll back to revision:
git reset --hard REVISION
- Revert a file to revision:
git checkout REVISION path/to/file
- Get my colleague's file version during a merge:
git checkout --theirs path/to/file
- Add a remote :
git remote add origin https://github.com/user/repo.git
- Force unstash :
git stash show -p | git apply && git stash drop
- clone a branch:
git clone -b <branch> <remote>
- Better
git log
: https://coderwall.com/p/euwpig - Rebase master from branch: git checkout master && git rebase branch
- Only push current branch with
git push
:git config --global push.default current
- Create a branch from a commit:
git branch <branch> <hash>
- Find last revision of a file:
git rev-list -n 1 HEAD -- <file>
- Revert this file:
git checkout <revision>~1 <file>
Last active
August 29, 2015 13:55
-
-
Save ayamflow/8690726 to your computer and use it in GitHub Desktop.
Handy Git commands
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
git reset HEAD path/to/file
git reset HEAD~1
git add -p
git checkout -p