Skip to content

Instantly share code, notes, and snippets.

@jasonamyers
Last active June 6, 2018 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonamyers/0824e39e0573f6bad78e474e1977df39 to your computer and use it in GitHub Desktop.
Save jasonamyers/0824e39e0573f6bad78e474e1977df39 to your computer and use it in GitHub Desktop.
Git Power Up May

Diff so fancy

Chunking

  • tree -L 2
  • git add -p
y - stage this hunk
n - do not stage this hunk
q - quit; do not stage this hunk or any of the remaining ones
a - stage this hunk and all later hunks in the file
d - do not stage this hunk or any of the later hunks in the file
e - manually edit the current hunk
? - print help

Logs

  • git log --stat
  • git lg

git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative --all"

Other Diffs

  • git diff --numstat
  • git diff --shortstat
  • git diff --dirstat
  • git diff --name-status
  • git whatchanged
brew install diff-so-fancy
git config --global core.pager "diff-so-fancy | less --tabs=4 -RFX"
git config --global color.ui true
git config --global color.diff-highlight.oldNormal "red bold"
git config --global color.diff-highlight.oldHighlight "red bold 52"
git config --global color.diff-highlight.newNormal "green bold"
git config --global color.diff-highlight.newHighlight "green bold 22"
git config --global color.diff.meta "yellow"
git config --global color.diff.frag "magenta bold"
git config --global color.diff.commit "yellow bold"
git config --global color.diff.old "red bold"
git config --global color.diff.new "green bold"
git config --global color.diff.whitespace "red reverse"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment