Skip to content

Instantly share code, notes, and snippets.

@seveibar
Created November 27, 2016 23:23
Show Gist options
  • Save seveibar/6b7877958d44cef7318f31011ac6344d to your computer and use it in GitHub Desktop.
Save seveibar/6b7877958d44cef7318f31011ac6344d to your computer and use it in GitHub Desktop.
If you prefer to always work in a detached head state, this will allow you to quickly do a PR and return to master w/o creating branches
#!/bin/bash
git checkout -b $1
git push origin $1
hub pull-request
read -p "back to master? <y/N> " prompt
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
then
git fetch
git checkout origin/master
else
git checkout HEAD^1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment