Skip to content

Instantly share code, notes, and snippets.

@IanVaughan
Created December 14, 2015 12:16
Show Gist options
  • Save IanVaughan/19bf2b86142ab2749899 to your computer and use it in GitHub Desktop.
Save IanVaughan/19bf2b86142ab2749899 to your computer and use it in GitHub Desktop.
Git scripts to make life easier. Put somewhere in your $PATH, and ensure they are executable `chmod +x`
#!/bin/sh -x
# Locally delete a upstream merged branch
# usage:
# merged
ref=$(git symbolic-ref HEAD 2> /dev/null) || exit 0
CURRENT="${ref#refs/heads/}"
git checkout master
git pull origin master
git branch --delete $CURRENT
#!/bin/sh -x
# Rebase current branch against master and (optional force) push to origin
#
# usage:
# rebase
# or:
# rebase -f
git checkout master
git pull origin master
git checkout -
git rebase master
git push $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment