Created
August 29, 2008 14:28
-
-
Save vinbarnes/7978 to your computer and use it in GitHub Desktop.
hack && ship functions that are git-svn aware
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
function git-svn-repo? { | |
git branch -r 2>/dev/null | awk '{if ($1=="git-svn") {exit 0} else {exit 1}}' | |
} | |
function git-agnostic-pull { | |
if $(git-svn-repo?); then | |
git svn rebase | |
else | |
git pull origin master | |
fi | |
} | |
function git-agnostic-push { | |
if $(git-svn-repo?); then | |
git svn dcommit | |
else | |
git push origin master | |
fi | |
} | |
function git-current-branch { | |
git branch | grep '\*' | awk '{print $2}' | |
} | |
function hack { | |
CURRENT=git-current-branch | |
git checkout master | |
git-agnostic-pull | |
git checkout ${CURRENT} | |
git rebase master | |
} | |
function ship { | |
CURRENT=git-current-branch | |
git checkout master | |
git merge ${CURRENT} | |
git-agnostic-push | |
git checkout ${CURRENT} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment