Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Closing, then reopening a pull request with some new commits

Tags:

git

github

I've had a PR open for a few days that's now a little stale. I've been asked to close it, make some changes, then re-open.

I'm not sure how to do that however-- and the current pull request has about five commits to it.

Should I open a new branch, make my new modifications, then submit a PR from there? If so, how can that PR have the other five commits in it? If there are better ways to do this I'd be interested to know.

like image 747
jkj2000 Avatar asked Apr 27 '15 21:04

jkj2000


People also ask

Can you close and reopen a pull request?

You need the rights to reopen pull requests on the repository. The pull request hasn't been merged, just closed. Go to Pull requests add filter `is:closed` choose PR you want to reopen. Select from checkbox and mark as Open.

What happens when you close a pull request?

In the pull request, choose Close pull request. This option closes the pull request without attempting to merge the source branch into the destination branch. This option does not provide a way to delete the source branch as part of closing the pull request, but you can do it yourself after the request is closed.

Can I add new commits to pull request?

You can commit changes on a pull request branch that was created from a fork of your repository with permission from the pull request creator. You can only make commits on pull request branches that: are opened in a repository that you have push access to and that were created from a fork of that repository.

Can you redo a pull request?

You can revert a pull request after it's been merged to the upstream branch.


1 Answers

A pull request is, effectively, one person requesting that their branch make their way into another branch, so you're only dealing with branches at a Git level.

At a GitHub level, you can close a PR without deleting the branch, which is likely what you want to do here.

How you proceed depends on the history you want. Note that I'm invoking these from a local Git standpoint, as the GitHub interaction we need is only really concerned with the PR.

  • If you want to simply continue the work you need to and reopen the PR, then do the work on that branch directly. It will still have the other commits from that branch so you don't run the risk of anything getting lost.

    It also means one less branch to keep track of mentally, and one less branch to delete when all of the work is merged up. Lastly, it keeps the commit history cleaner, as there are no unnecessary merge commits lingering around.

  • If you want to branch off of the branch, then that's an option too - create a branch as you normally would, do your work, and then submit your PR. This branch will also have the other commits on it, so you don't run the risk of anything getting lost.

like image 135
Makoto Avatar answered Oct 02 '22 00:10

Makoto