Skip to content

Instantly share code, notes, and snippets.

@rick
Created August 29, 2008 14:39
Show Gist options
  • Save rick/7982 to your computer and use it in GitHub Desktop.
Save rick/7982 to your computer and use it in GitHub Desktop.
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-current-branch {
`git branch | grep '\*' | awk '{print $2}'`
}
function git-agnostic-push {
if $(git-svn-repo?); then
git svn dcommit
else
git push origin master
fi
}
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