Skip to content

Instantly share code, notes, and snippets.

@seanmhanson
Last active October 28, 2019 15:12
Show Gist options
  • Save seanmhanson/2ff2ef0be5fdc7e9e8e25c2c965c2f03 to your computer and use it in GitHub Desktop.
Save seanmhanson/2ff2ef0be5fdc7e9e8e25c2c965c2f03 to your computer and use it in GitHub Desktop.
Git Command to stash changes, pull master, and open a new branch
#!/bin/sh
if ! git diff-index --quiet HEAD --; then
echo 'Uncommitted local changes detected. Stashing...'
git stash
fi
echo 'Pulling Master'
git checkout master
git pull origin master
# I prefix with mongoDB project, but do whatever you want
echo 'Creating New Branch'
git checkout -b "CLOUDP-${1}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment