Skip to content

Instantly share code, notes, and snippets.

@jsit
Created December 22, 2020 15:42
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 jsit/d7a0b462c7423adbd04e0da5cdf0b978 to your computer and use it in GitHub Desktop.
Save jsit/d7a0b462c7423adbd04e0da5cdf0b978 to your computer and use it in GitHub Desktop.
Git config with conditional to test Git version
[alias]
lg = "!if (( \
$(echo \"$(git --version | sed -E 's/git version ([0-9]+.[0-9]+).*/\\1/') > 2.20\" | bc) \
)); then \
DATE="--date=human"; \
else \
DATE="--date=short"; \
fi; \
git log --pretty=tiny --abbrev-commit --$DATE"
[pretty]
tiny = format:%C(dim yellow)%h %C(dim blue)%<(16)%ad %C(italic dim black)%>(16,trunc)%an%C(auto) %s%d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment