Show log
git log
--author=""
– print commits by pointed user
--name-only
– only file name
--oneline
– commits comments in one line
--graph
– commits tree
--reverse
– old commits before new commits
--after
– commits after pointed date
--before
– commits before pointed date
Show the latest edits
git log -p <filename>
Show edits in pointed lines of file
git blame filename
git log -L 1,1:filename
Show no merged commits
git log --no-merges master..
git show --no-merges master..
git log -p --no-merges master..
Extract file from a branch
git show branch:file
Rebase
git rebase -i <commithash>
git pull -rebase
Local merge
git merge --no-ff branchname
Fix latest commit
git commit --amend
git push -f
(DON’T DO IT)
Status
git status -s
Reset
git reset --hard <hash>
– all commits after will disappear
git reset <hash>
– all commits after will be “not staged for commit”
git reet --soft <hash>
– all commits after will be “staged for commit”
Extract files
git checkout filename
git checkout branchname filename
git checkout commithash filename
Revert
git revert -n
Diff
git config --global diff.tool <name>
git config --global merge.tool <name>
git difftool filename
git difftool -d
Ignore space
git <some command> -w
Add a part of file
git add -p
Delete old branches
git branch -a --merged
git fetch -p
Stash
git stash --keep-index
git stash -p
git stash pop
git stash list
Bisect
git bisect
git bisect start
git bisect good <hash>
git bisect bad <hash>
git bisect good
git bisect bad
git bisect reset
git bisect log
Post navigation