10 January 2017

Discard local changes:

git checkout -- .

Find a commit that introduced a string in any file (on any branch):

git log -S whatever --source --all

The same on HEAD only:

git log -S whatever

See the commit graph across all branches for the last two weeks:

git log --all --since='2 weeks' --oneline --no-merges --decorate --graph
//--author=<your email address>

See also additions and deletions:

git log --graph --all --decorate --stat --date=iso

What changes am I about to pull in?

git checkout feature/fonts
git fetch
git log --oneline --no-merges ..origin/feature/fonts


git log --oneline --no-merges <last tag>..HEAD

Who made a change to these lines?

git blame -L5,10 component.versions

See what commits affected a file

git log --oneline --stat --follow DailyBuild/component.versions

See what commits affected a folder

git log --oneline -- subfolder

Latest commit that has foo in commit-message

git show :/foo | cat

Reset file hunks interactively

git checkout -p <path-to-file>

Word-diff instead of line-diff

git --no-pager diff --word-diff=color