Skip to content

Instantly share code, notes, and snippets.

@mauhiz
Created August 25, 2016 01:05
Show Gist options
  • Save mauhiz/506201e0b05a1dedb53fbf8b049b6061 to your computer and use it in GitHub Desktop.
Save mauhiz/506201e0b05a1dedb53fbf8b049b6061 to your computer and use it in GitHub Desktop.
git aliases
[alias]
s = status
c = checkout
ci = commit
cp = cherry-pick
b = branch
ss = stash save
dw = diff --word
dc = diff --cached
dch = diff --cached HEAD^
; look for a file
f = "!git ls-files | grep -i"
; various git logs
lon = log --oneline --decorate
long = log --oneline --graph --decorate
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
llds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
lldr = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
filelog = log -u
; find commit by title on develop
fc = "!f() { git fetch upstream && git log upstream/develop --oneline --no-merges | grep $1; }; f"
; find commit by title on master
fcm = "!f() { git fetch upstream && git log upstream/master --oneline --no-merges | grep $1; }; f"
; git-flow like: create a feature branch against develop
betafeature = "!f() { BRANCHNAME=feature-$1 && git checkout -b $BRANCHNAME upstream/develop; git push --set-upstream origin $BRANCHNAME; }; f"
; git-flow like: create a feature branch against master
libfeature = "!f() { BRANCHNAME=feature-$1 && git checkout -b $BRANCHNAME upstream/master; git push --set-upstream origin $BRANCHNAME; }; f"
; git-flow like: create a release branch against master
releasefeature = "!f() { BRANCHNAME=feature-$1-release && git checkout -b $BRANCHNAME upstream/master; git push --set-upstream origin $BRANCHNAME; }; f"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment