Skip to content

Instantly share code, notes, and snippets.

@frontmesh
Created May 15, 2013 15:42
Show Gist options
  • Save frontmesh/5584949 to your computer and use it in GitHub Desktop.
Save frontmesh/5584949 to your computer and use it in GitHub Desktop.
Seqence of git merge commands for pulling and merging remote branches
#!/bin/bash
current_branch=`git branch|grep "*" | cut -d " " -f 2 `
target_branch=$1
if [ -z "$1" ]
then
echo "No target branch supplied"
else
`git checkout $target_branch`
`git pull origin $target_branch`
`git checkout $current_branch`
`git merge $target_branch`
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment