Easy pull requests from master with git-offload

When using git, I often find myself committing some work to master locally, and having to move it all to a branch from which I can make a pull request. Then I have to clean up afterwards.

I do this often, yet it's tedious and I still sometimes have to look up the exact format of the git commands. So, I wrote a script to automate it, git-offload.

Simply pass in the new branch name and the remote to you want to push the new branch, and git-offload automatically does the following things:

  • Creates a new branch from your current commit
  • Pushes that branch to an upstream of your choice
  • Goes back to the original branch
  • Resets the original branch to its upstream state

You can download git-offload from Gist.