Skip to content

Instantly share code, notes, and snippets.

@theconsultant
Created November 11, 2014 15:34
Show Gist options
  • Save theconsultant/1dc02bc3754abaf74f9b to your computer and use it in GitHub Desktop.
Save theconsultant/1dc02bc3754abaf74f9b to your computer and use it in GitHub Desktop.
Script to switch to master, update it, then merge with branch you were in before.
#!/bin/bash
echo "Noting which branch you are currently in."
MYBRANCH=`git rev-parse --abbrev-ref HEAD`
echo $MYBRANCH
echo "Updating current branch"
git pull
#echo "Branch list"
#git branch --list
echo "Switching to Master"
git checkout master
echo "Updating master branch"
git pull
echo "Switching to previous branch"
git checkout $MYBRANCH
echo "Merging with Master"
git merge master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment