Git#

Git fetch#

Recipes for git fetch.

Prune branches#

git fetch -p

Before fetching, remove any remote-tracking references that no longer exist on the remote.

Git log#

Recipes for git log.

Graph on the command line#

git log --graph --oneline --decorate

Files changed per commit between two dates#

git log --before=2022-01 --until=2022-02 --name-only --pretty=format:"%hx09 -- %an%x09%ad%x09%s"

Rebase#

Recipes for git rebase.

Auto-fixup#

Mark the commit as a fixup (for squash, use --squash) of a commit with hash <bad-commit-hash>.

git commit --fixup <ad-commit-hash>
git rebase -i <from-hash> --autosquash

This will create a message like fixup! Bad-commit-subject-line. When rebasing, all !fixup-commits will be moved and merged into their “parent” commits automatically, assuming they are located after <from-hash>.