This is an old revision of the document!


  • git prune (use git gc)
  • git whatchanged (use git log)
  • git annotate (use git blame)
  • More people should read man gitcli. Seriously.
  • git log --remove-empty – stop when a given path disappears.
  • git reset will not delete files it does not track, including files it is told to ignore.
  • git push will not affect the remote working tree; try to avoid pushing to non-bare repos
  • git config --global alias.unadd “reset HEAD”
  • git rev-list HEAD | tail -1 to get root commit
  • Config variable checkout.defaultRemote
  • use git fsck to track down staged, then reset files (git show)
  • reset a file with git checkout -p
  • git rm -rf :/ && git checkout commit-ish – :/
  • Danger with reverting a merge commit.
  • Renaming:
    • git log -M
  • git push origin +branchname
  • comprehensive guide to dealing with whitespace issues
  • branch names and wildcarding
  • git cat-file -p HEAD
  • git ls-tree -r HEAD
  • git ls-files -s
  • smudge and clean filters
  • git.1552596390.txt.gz
  • Last modified: 2019/03/14 20:46
  • by rpjday