Created
December 23, 2009 22:11
-
-
Save vgrichina/262851 to your computer and use it in GitHub Desktop.
Interactive merge utility for Git, as described here http://www.angrylibertarian.com/node/53
This file contains 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 | |
# git-interactive-merge | |
# Taken from: http://www.angrylibertarian.com/node/53 | |
from=$1 | |
to=$2 | |
if [[ ( -z $from ) || ( -z $to ) ]]; then | |
echo "Usage:" | |
echo " git-interactive-merge <from-branch> <to-branch>" | |
exit 1 | |
fi | |
echo "Checking out $from branch" | |
git checkout $from || exit 1 | |
echo "Creating ${from}_tmp branch" | |
git checkout -b ${from}_tmp || exit 1 | |
echo "Rebasing on ${to} branch" | |
git rebase -i $to || exit 1 | |
# Above will drop you in an editor and pick the changes you want | |
echo "Checking out $to branch" | |
git checkout $to || exit 1 | |
echo "Pulling from ${from}_tmp branch" | |
git pull . ${from}_tmp || exit 1 | |
echo "Removing ${from}_tmp branch" | |
git branch -d ${from}_tmp || exit 1 | |
echo "Success!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment