Skip to content

Instantly share code, notes, and snippets.

@weshouman
Last active October 28, 2017 06:40
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 weshouman/823843c6657de8e1cbd5 to your computer and use it in GitHub Desktop.
Save weshouman/823843c6657de8e1cbd5 to your computer and use it in GitHub Desktop.
useful git config/aliases #vcs
[user]
email = MYEMAIL
name = My Name
[alias]
co = checkout
ci = commit
st = status
di = diff
lg1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git lg1"
# Statistics using author name/email as positional parameters
#= get the number of commits with the name walid in them
## Example
## git fame "Walid Shouman"
fame = "!f() { git rev-list --all --count --author=\""$1"\"; }; f"
#= get the commits of some author
## Example
## git contribution "Walid Shouman"
contribution = "!f() { git shortlog --author=\""$1"\"; }; f"
# this one was a hack to capture commit count, it's not accurate as a name could be incremented due to being in the commit message
# fame = "!f() { git log | grep -o "$1" | wc -l; }; f"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment