Skip to content

Instantly share code, notes, and snippets.

@loren138
Created April 15, 2016 20:41
Show Gist options
  • Save loren138/7aa50ceecc05e466f421c0adcb35563f to your computer and use it in GitHub Desktop.
Save loren138/7aa50ceecc05e466f421c0adcb35563f to your computer and use it in GitHub Desktop.
Update and merge current branch with develop via stash for GitFlow or HubFlow
#!/bin/bash
set -e
branch=$(git rev-parse --abbrev-ref HEAD)
stash=false;
if ! git diff-index --quiet HEAD --; then
stash=true
git stash
fi
git checkout develop
git pull
git checkout $branch
git merge develop
if [ "$stash" = true ] ; then
git stash pop
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment