Skip to content

Instantly share code, notes, and snippets.

@pierskarsenbarg
Last active December 3, 2020 10:46
Show Gist options
  • Save pierskarsenbarg/20cc62ade1a9f2cba070333cd8d47d5e to your computer and use it in GitHub Desktop.
Save pierskarsenbarg/20cc62ade1a9f2cba070333cd8d47d5e to your computer and use it in GitHub Desktop.
git aliases
[alias]
co = checkout
ec = config --global -e
po = push origin head
up = !git pull --rebase --prune $@ && git submodule update --init --recursive
cob = checkout -b
cm = !git add -A && git commit
save = !git add -A && git commit -m 'SAVEPOINT'
wip = !git add -u && git commit -m WIP
undo = reset HEAD~1 --mixed
amend = commit -a --amend
wipe = !git add -A && git commit -qm 'WIPE SAVEPOINT' && git reset HEAD~1 --hard
bclean = "!f() { git branch --merged ${1-main} | grep -v ${1-main}$ | xargs git branch -d; }; f"
bdone = "!f() { git checkout ${1-main} && git up && git bclean ${1-main}; }; f"
syncforkpush = !git fetch upstream && git co main && git merge upstream/main && git po
syncfork = !git fetch upstream && git co main && git merge upstream/main
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
addupstream = "!f() { git remote add upstream $1; }; f"
pr = !hub pull-request | clip
sf = syncfork
sfp = syncforkpush
start = !git co -- . && git bdone
first = push -u origin head
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment