Skip to content

Instantly share code, notes, and snippets.

@fudanchii
Created March 15, 2015 20:00
Show Gist options
  • Select an option

  • Save fudanchii/a52a5eb6e5949f7c3083 to your computer and use it in GitHub Desktop.

Select an option

Save fudanchii/a52a5eb6e5949f7c3083 to your computer and use it in GitHub Desktop.
#! /usr/bin/env bash
interim_branch=default
rollgit() {
[[ $# -ne 1 ]] && {
echo 'wrong number of arguments, USAGE:'
printf "\tgit roll <branch>\n"
exit 1
}
git rebase $1 && git co $1 && git rebase $interim_branch && git branch -D $interim_branch
}
unhg() {
[[ $# -ne 2 ]] && {
echo 'wrong number of arguments, USAGE:'
printf "\tgit unhg <remote> <branch>\n"
exit 1
}
git-hg fetch $1 && git co -b $interim_branch FETCH_HEAD && git roll $2
}
self=$(basename $0)
case $self in
git-unhg)
unhg $*
;;
git-roll)
rollgit $*
;;
*)
echo 'Invalid command specified'
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment