Skip to content

Instantly share code, notes, and snippets.

@raecoo
Forked from bimlas/.gitconfig
Created November 17, 2015 22:42
Show Gist options
  • Select an option

  • Save raecoo/93a5bd4011da5ce97800 to your computer and use it in GitHub Desktop.

Select an option

Save raecoo/93a5bd4011da5ce97800 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