Skip to content

Instantly share code, notes, and snippets.

@xml
Created April 25, 2017 05:46
Show Gist options
  • Save xml/8eb5a73b3cbeb4adecf8b013671f85d0 to your computer and use it in GitHub Desktop.
Save xml/8eb5a73b3cbeb4adecf8b013671f85d0 to your computer and use it in GitHub Desktop.
Shell Script for Git: Update Master and Return to Current Branch
function mu() {
branch=`git rev-parse --symbolic-full-name --abbrev-ref HEAD`
echo "After updating master, will return to $branch..."
git checkout master
#TO-DO: check status and only pull if not up-to-date...
git pull
git checkout $branch
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment