Skip to content

Instantly share code, notes, and snippets.

@tangoslee
Last active November 25, 2024 20:35
Show Gist options
  • Select an option

  • Save tangoslee/e29151d70e1fe8a7e1668680ad11b87e to your computer and use it in GitHub Desktop.

Select an option

Save tangoslee/e29151d70e1fe8a7e1668680ad11b87e to your computer and use it in GitHub Desktop.
gitconfig
[core]
editor = vim
autocrlf = false
eol = LF
fileMode = false
[user]
email = iam@fake.test
name = Tom
[push]
default = matching
[alias]
logs = log --graph --oneline --decorate --date-order --pretty=format:"%Cred%h%Creset\\ -%C(yellow)%d\\ %Creset%s\\ %Cgreen(%cr)\\ %C(cyan)<%an>%Creset"
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%C(cyan)\\ [%cn]" --decorate
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%C(cyan)\\ [%cn]" --decorate --numstat
lnc = log --pretty=format:"%h\\ %s\\ [%cn]" --decorate
lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%C(cyan)\\ [%cn]" --decorate --date=short
ld = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%C(cyan)\\ [%cn]" --decorate --date=relative
lsb = for-each-ref --sort=-committerdate refs/remotes/origin/
llb = for-each-ref --sort=-committerdate refs/heads/ --format='%(authordate:short) %(color:red)%(objectname:short) %(color:yellow)%(refname:short)%(color:reset) (%(color:green)%(committerdate:relative)%(color:reset))'
filelog = log -u
#
fl = log -u
# Show modified files in last commit:
dl = "!git ll -1"
# Show a diff last commit;
dlc = diff --cached HEAD^
# Reset
r = reset
r1 = reset HEAD^
r2 = reset HEAD^^
rh = reset --hard
rh1 = reset HEAD^ --hard
rh2 = reset HEAD^^ --hard
nah = !git reset --hard && git clean -df
branches = !echo ' ------------------------------------------------------------' && git for-each-ref --sort='-authordate:iso8601' --format=' %(authordate:relative)%09%(refname:short)' refs/heads && echo ' ------------------------------------------------------------'
show-branches = for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'
# http://durdn.com/blog/2012/11/22/must-have-git-aliases-advanced-examples/
[diff]
renamelimit = 5000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment