Created
August 30, 2016 10:48
-
-
Save dflima/98d12282bb3357fa1564cd499c5e0fa1 to your computer and use it in GitHub Desktop.
Checkout to a base branch (master, develop etc.) and merges to your current branch
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 | |
function usage() | |
{ | |
printf "Usage:\n\n" | |
printf "./merge_branches.sh <branch>\n\n" | |
} | |
if [ "$1" == "" ]; then | |
usage | |
exit 0 | |
fi | |
source_branch="$(git branch | grep \* | cut -d ' ' -f2)" | |
dest_branch=$1 | |
git checkout $dest_branch; | |
git pull -p; | |
git checkout $source_branch; | |
git merge $dest_branch --no-ff; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment