Every Git page below this section is a candidate for current updating – many of those pages are still just fine, but are subject to improvement in the near future.
man gitcli. Seriously.
git log --remove-empty– stop when a given path disappears.
git resetwill not delete files it does not track, including files it is told to ignore.
git pushwill 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 -1to get root commit
git fsckto track down staged, then reset files (
git checkout -p
git rm -rf :/ && git checkout commit-ish – :/
git log -M
git push origin +branchname
git checkout -b maint origin/maint
git diff –name-only <commit>^!
git cat-file -p HEAD
git ls-tree -r HEAD
git ls-files -s