Skip to content

Instantly share code, notes, and snippets.

@shercoder
Last active August 10, 2016 19:14
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 shercoder/3a0d49fd53585633eecd to your computer and use it in GitHub Desktop.
Save shercoder/3a0d49fd53585633eecd to your computer and use it in GitHub Desktop.
Wanderful Gitconfig
[alias]
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
lr = log --pretty=format:"%Creset%s%Cblue\\ [%cn]" --decorate
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
lnc = log --pretty=format:"%h\\ %s\\ [%cn]"
lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
ld = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
le = log --oneline --decorate
dag = log --graph --oneline --decorate --all
brdiff = log --graph --pretty=format:"%Cred%h%Creset\\ -%C(yellow)%d%Creset\\ %s\\ %Cgreen(%cr)%Creset\\" --abbrev-commit --date=relative
new = !sh -c 'git log $1@{1}..$1@{0} "$@"'
# show history of a file with diffs
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^
# Fine a file path in codebase
f = "!git ls-files | grep -i"
# list all your aliases
la = "!git config -l | grep alias | cut -c 7-"
# Rename [branch to done-[branch]
done = "!f() { git branch | grep "$1" | cut -c 3- | grep -v done | xargs -I{} git branch -m {} done-{}; }; f"
# Ignore or retrack files that are under version control
assume = update-index --assume-unchanged
unassume = update-index --no-assume-unchanged
# show assumed files
assumed = "!git ls-files -v | grep ^h | cut -c 3-"
# unassume all the assumed files
unassumeall = "!git assumed | xargs git update-index --no-assume-unchanged"
# assume all
assumeall = "!git st -s | awk {'print $2'} | xargs git assume"
# unstage/uncommit
unstage = reset HEAD --
# basics
cp = cherry-pick -x # -x adds old commit hash in commit comment
st = status -s
cl = clone
ci = commit
co = checkout
br = branch -vv
bm = branch -m
diff = diff --word-diff
dc = diff --cached
pl = pull
ps = push
cm = commit
a = add
#reset commands
r = reset
r1 = reset HEAD^
r2 = reset HEAD^^
rh = reset --hard
rh1 = reset HEAD^ --hard
rh2 = reset HEAD^^ --hard
# stash operations
sl = stash list
sa = stash apply
ss = stash save
sp = stash pop
sd = stash drop
# deleting branch operations
# delete local and remote branch
dbr = push origin --delete
[color]
ui = true
[user]
name = Charlie Whatsgood
email = charlie@whatsgood.com
logallrefupdates = true
[core]
excludesfile = /Users/psingh/.gitignore
editor = vim
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[merge]
conflictstyle = diff3
summary = true
[filter "media"]
clean = git-media-clean %f
smudge = git-media-smudge %f
[pull]
rebase = preserve
default = current
[push]
default = current
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment