Skip to content

Instantly share code, notes, and snippets.

@chrisolsen
Last active November 6, 2019 21:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisolsen/fa6b4d7fa952a1f04feb20bddb34e60f to your computer and use it in GitHub Desktop.
Save chrisolsen/fa6b4d7fa952a1f04feb20bddb34e60f to your computer and use it in GitHub Desktop.
git commit and squash to PR branch
#!/bin/bash
git branch | grep "\*" | cut -d " " -f 2 | {
read br
git checkout -B pr-$br
git reset --soft master
git commit -m "$1"
echo "pushing to pr-$br..."
git push origin "pr-$br" -f
git checkout $br
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment