Skip to content

Instantly share code, notes, and snippets.

@cbillowes
Last active October 5, 2019 17:02
Show Gist options
  • Save cbillowes/948406c1826ab6d5f935350474288934 to your computer and use it in GitHub Desktop.
Save cbillowes/948406c1826ab6d5f935350474288934 to your computer and use it in GitHub Desktop.
Advanced Git commands
# list all commits for a given file which includes cases where the file has been renamed.
git log --follow -- filename
# log with a decorated graph
git log --graph --abbrev-commit --decorate --date=relative --all
# short status on branch
git status --short --branch
# see log with diffs
git log --stat
git log --stat -p
# compact log
git log --oneline --decorate --graph --all
# log with graph and decorated information
# https://stackoverflow.com/questions/1057564/pretty-git-branch-graphs
git log --pretty='%Cblue%h%Creset | %C(yellow)%d%Creset %s %Cgreen(%cr)%Creset %C(cyan)[%an]%Creset' --graph
# Visualize per-character differences in a unified diff file
# https://stackoverflow.com/questions/3231759/how-can-i-visualize-per-character-differences-in-a-unified-diff-file
git diff --word-diff --unified=10
git diff --color-words
git diff --color-words='[^[:space:]]|([[:alnum:]]|UTF_8_GUARD)+'
@cbillowes
Copy link
Author

cbillowes commented Sep 7, 2019

Install script. You'll need to update your alias to the revision you want to reference.

alias advanced="curl https://gist.githubusercontent.com/cbillowes/948406c1826ab6d5f935350474288934/raw/7b1369b5c8b06b5db9dab53feb9bd78c457ac618/advanced-git.txt; echo;"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment