Skip to content

Instantly share code, notes, and snippets.

@bimlas
Created November 16, 2015 08:33
Show Gist options
  • Save bimlas/0a3795b6fa89adc7ce7a to your computer and use it in GitHub Desktop.
Save bimlas/0a3795b6fa89adc7ce7a to your computer and use it in GitHub Desktop.
Using of variables in Git aliases
# Simplify the similar aliases in .gitconfig by using variables instead of
# copying the same flags.
[alias]
flags = "!FLAG_LOG='--graph --decorate --find-renames --date-order'; \
FLAG_DIFF='--patch --stat --ignore-blank-lines';"
glog = "!git flags; git log $FLAG_LOG --name-status"
gslog = "!git flags; git log $FLAG_LOG --stat"
slog = "!git flags; git log $FLAG_LOG --date=short --format='%C(auto)%h%C(auto)%d %C(bold blue)%ad %an%n %s%C(reset)'"
df = "!git flags; git diff $FLAG_DIFF"
dfc = "!git flags; git diff $FLAG_DIFF --cached"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment