Skip to content

Instantly share code, notes, and snippets.

@christianacca
Last active April 28, 2017 04:35
Show Gist options
  • Save christianacca/4d31bb0f1126a352a3c2 to your computer and use it in GitHub Desktop.
Save christianacca/4d31bb0f1126a352a3c2 to your computer and use it in GitHub Desktop.
GIT aliases for keeping history clean
[alias]
ec = config --global -e
co = checkout
cob = checkout -b
pushit = "!f() { git rev-parse --abbrev-ref HEAD ; }; git push --set-upstream origin `f`"
up = !git pull --rebase --prune $@ && git submodule update --init --recursive
startb = "!f() { git cob $1 && git pushit; }; f"
syncb = !git fetch origin ${1-master} && git rebase origin/${1-master}
cleanb = !git rebase -i origin/${1-master}
finishb = "!f() { git rev-parse --abbrev-ref HEAD | xargs -i_branch sh -c 'git checkout ${1-master} -f && git pull origin && git merge _branch --ff-only && git push origin ${1-master}'; }; f"
deleteb = "!f() { git branch -d $1 && git push origin --delete $1;}; f"
fdeleteb = "!f() { git branch -D $1 && git push origin --delete -f $1;}; f"
cml = !git add -A && git commit -m
cm = "!f() { git cml \"$@\" && git push origin;}; f"
save = !git add -A && git commit -m 'SAVEPOINT'
wip = !git add -u && git commit -m "WIP"
ammend = !git add -A && git commit --amend
wipe = !git add -A && git commit -qm 'WIPE SAVEPOINT' && git reset HEAD~1 --hard
bclean = "!f() { git branch --merged ${1-master} | grep -v " ${1-master}$" | xargs -r git branch -d; }; f"
bdone = "!f() { git checkout ${1-master} && git up && git bclean ${1-master}; }; f"
new = "!f() { git log $1@{1}..$1@{0} \"$@\" ;}; f"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment