Skip to content

Instantly share code, notes, and snippets.

@cypai
Last active September 5, 2016 00:04
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 cypai/563a92369d2902d7438a85571c8a13e6 to your computer and use it in GitHub Desktop.
Save cypai/563a92369d2902d7438a85571c8a13e6 to your computer and use it in GitHub Desktop.
[alias]
aka = "!git config -l | grep alias | cut -c 7-"
amend = commit --amend
ac = "!git add . && git commit -am"
amc = "!git add . && git commit --amend"
cm = commit -m
cp = cherry-pick
cpcont = cherry-pick --continue
co = checkout
cof = checkout remotes/origin/master --
rb = rebase
rbm = rebase -i master
rbc = rebase --continue
rsth = "!f() { echo 'Hard resetting back to HEAD~$1... Current commit hash: ' && git rev-parse HEAD && git reset --hard HEAD~$1; }; f"
undo = reset --soft HEAD~1
stat = status -s
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
lf = log --pretty=format:\"%C(yellow)%h%Cred%d\\ %Creset%s%C(bold blue)\\ [%cn]\" --decorate --numstat
lastf = "!git lf -1"
prunem = "!git branch --merged | grep -v \"\\*\" | grep -v \"master\" | xargs -n 1 git branch -d"
zap = "!git branch | grep -v \"\\*\" | grep -v \"master\" | grep -v '-' | xargs -n 1 git branch -D"
f = "!git ls-files | grep -i"
fl = log -u
dfm = diff master HEAD
dfl = diff --cached HEAD^
dfs = diff --staged
dfc = "!f() { git diff "$1"^.."$1"; }; f"
grep = grep -Iirn
greprt = "!f() { A=$(pwd) && TOPLEVEL=$(git rev-parse --show-toplevel) && cd $TOPLEVEL && git grep --full-name -In $1 | xargs -I{} echo $TOPLEVEL/{} && cd $A; }; f"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment