Skip to content

Instantly share code, notes, and snippets.

@dennisdoomen
Created December 28, 2018 14:54
Show Gist options
  • Save dennisdoomen/10a4efcc64a71e115449d983733750f2 to your computer and use it in GitHub Desktop.
Save dennisdoomen/10a4efcc64a71e115449d983733750f2 to your computer and use it in GitHub Desktop.
Git Aliases
[alias]
co = checkout
ec = config --global -e
up = !git pull --rebase upstream $(git symbolic-ref --short HEAD) --prune $@ && git submodule update --init --recursive
cob = checkout -b
cm = !git add -A && git commit -m
save = !git add -A && git commit -m 'SAVEPOINT' --no-verify
wip = !git add -u && git commit -mWIP --no-verify
undo = reset HEAD~1 --mixed
amend = commit -a --amend -n
wipe = !git add -A && git commit -qm 'WIPE SAVEPOINT' --no-verify && git reset HEAD~1 --hard
bcleanall = "!f() { git branch | grep -v master | grep -v develop | xargs git branch -D; }; f"
bdone = "!f() { git checkout ${1-develop} && git up && git bclean ${1-develop}; }; f"
fa = !git fetch --all --prune --no-tags && git fetch upstream --tags
discard = "!f() { git merge ${1-upstream/master} --strategy ours -v -m 'Discarded already merged changes from ${1-upstream/master}'; }; f"
fixup = !git commit --fixup
fix = "!f() { git commit --fixup $1; GIT_SEQUENCE_EDITOR=touch git rebase -i $1^^ --autosquash --autostash; }; f"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment