Git notes for future me

Maintainers of Git never seems to run out of cool ideas. I am learning new tircks all the time, so I figured I compile down a list of things as I learn them.

Logs for a folder that don't have the word something

$ git log --grep '^something' --invert-grep --oneline $ref..HEAD -- folder/

One-Liner logs since 5 days ago

$ git log --after=$(date -d -5days + "%Y-%m-%d") --oneline

Exclude files when finding something

$ git grep something -- './*' ':(exclude)*.md'

Find top 10 authors for a repo

$ git shortlog -s -n | head -10

Reusing Recorded Resolutions.

If I am resolving the same merge conflict over and over again. git rerere will learn the change and repeat it next time around,

git config --global rerere.enabled true  
comments powered by Disqus