Created
February 15, 2012 10:01
-
-
Save nikreiman/1834857 to your computer and use it in GitHub Desktop.
Rebase all unpushed commits -- very nice to do before pushing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function git-branch-current() { | |
printf "%s\n" $(git branch 2> /dev/null | grep -e ^* | tr -d "\* ") | |
} | |
function git-log-last-pushed-hash() { | |
local currentBranch=$(git-branch-current); | |
git log --format="%h" -n 1 origin/${currentBranch} | |
} | |
function git-rebase-unpushed() { | |
git rebase --interactive $(git-log-last-pushed-hash) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment