Skip to content

Instantly share code, notes, and snippets.

@fhemberger
Created November 20, 2015 23:14
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 fhemberger/3676b14899a4591498b3 to your computer and use it in GitHub Desktop.
Save fhemberger/3676b14899a4591498b3 to your computer and use it in GitHub Desktop.

I'm using the git pr command from the git-extras toolset to check out a local copy of a PR.

To rebase the PR again, I wrote a little script, which needs to be run in the PR's branch:

#!/usr/bin/env bash

branch=$(git symbolic-ref HEAD --short)

git rebase master
git checkout master
git merge --ff-only $branch
git push origin master

This closes the PR directly.

@fhemberger
Copy link
Author

Specify target branch git-pr-rebase <branchname> (defaults to 'master'):

#!/usr/bin/env bash

branch=$(git symbolic-ref HEAD --short)
target=${1:-master}

git rebase $target
git checkout $target
git merge --ff-only $branch
git push origin $target

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment