Skip to content

Instantly share code, notes, and snippets.

@atenni
Forked from robertpainsi/README.md
Created September 11, 2023 05:15
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 atenni/260fca6d20b5a969aa9a5bf4d4ccd2ae to your computer and use it in GitHub Desktop.
Save atenni/260fca6d20b5a969aa9a5bf4d4ccd2ae to your computer and use it in GitHub Desktop.
How to reopen a pull-request after a force-push?

How to reopen a pull-request after a force-push?

Precodinitions

  • You need the rights to reopen pull requests on the repository.
  • The pull request hasn't been merged, just closed.

Instructions

  1. Write down the current commit hash of your PR-branch git log --oneline -1 <PR-BRANCH>
  2. Write down the latest commit hash on github before the PR has been closed.
  3. git push -f origin <GITHUB-HASH-FROM-STEP-2>:<PR-BRANCH>
  4. Reopen the PR.
  5. git push -f origin <HASH-FROM-STEP-1>:<PR-BRANCH>

Example

You've a PR branch my-feature currently at 1234567. Looking at the the PRs page, we see that the PR was closed when my-feature pointed at 0abcdef.

  • git push -f origin 0abcdef:my-feature #pushing the old commit the PR has been closed with
  • Reopen the PR.
  • git push -f origin 1234567:my-feature #pushing the latest commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment