0

I created a new pull request on github, and I happened to deleted the forked branch in my github account. Now the reviewers ask me modify something in the code, but I find my pr is isolated and I cannot modify it directly.

I got to find this document, but I do not know what the step of $ git fetch origin pull/ID/head:BRANCHNAME mean.

Suppose my pr ID is #708 and the repository that I submit my pr into is https://github.com/facebookresearch/maskrcnn-benchmark and I would like to have my pr merged into the master branch.

I tried to use git fetch origin pull/#708/https://github.com/facebookresearch/maskrcnn-benchmark:master, but it failed.

How could I continue to commit my pr please?

by the way, if I have a pr under-reviewing, how could I submit another pr without deleting the existing fork?

coin cheung
  • 949
  • 2
  • 10
  • 25

1 Answers1

0

Italics are crucial in the document you found. Everything not in italics is literal, which includes head. The ID only refers to the digits (no #, the included screenshot is a little unlucky):

$ git fetch origin pull/708/head:foobar

will do the job, with foobar being your new local branch name for the pull request.

Michi
  • 681
  • 1
  • 7
  • 25
  • Thanks, I have pulled the pr in my local machine. by running `git remote -vv` I find the remote origin is the official repository. If I have modified my code, could I submit the modification to the pr with `git commit -m 'ddd'; git push origin local_branch` ? – coin cheung Jun 02 '19 at 00:38
  • What do you mean by *"the remote origin is the official repository"*? Well, I haven't tried it, but I guess you can just push to a new branch. Probably you want to push as [upstream (`-u`)](https://stackoverflow.com/a/6232535/1281339). – Michi Jun 02 '19 at 00:49
  • Hi, I am submitting the pr via forking the original repository and then click the button of `pull request`. I used to submit my modifications to my forked the repository and the modifications will be updated to the pr page. Now after training the method in the documents, I have downloaded the deleted forked repository to my local machine. But I cannot direct use `git push` because the downloaded repo is pointing at the original branch rather than the deleted forked pr repo. How could I further submitting the pr after I downloaded the repo please? – coin cheung Jun 02 '19 at 01:14
  • I haven't tried this yet, but I guess you can just [change your remote (origin)](https://help.github.com/en/articles/changing-a-remotes-url) to your forked repository, push to that forked repository and then pull request again. – Michi Jun 02 '19 at 01:46