0

I forked a repo, added new branches and have currently some open pull requests.

Now I have done something wrong inside a branch and want to re-fork it from the original.

How can I do this? I can not remove the whole fork because of the open pull requests.

I am a newbie and until now, I did everything on the github web page. Now I have downloded the 'Github Desktop' software, but it seems that this tool is not helpful for that.

TheMe
  • 1
  • 1
  • Possible duplicate of [Reset local repository branch to be just like remote repository HEAD](https://stackoverflow.com/questions/1628088/reset-local-repository-branch-to-be-just-like-remote-repository-head) – phd Dec 09 '17 at 14:32
  • "Now I have done something wrong inside a branch and want to re-fork it from the original." What is the original branch you refer to here? Do you mean a the branch as it exists in your GitHub repo? Or does this branch exist in the repo which you forked? Or do you just want to reset your local branch back to `master` or some other base branch? – Code-Apprentice Dec 09 '17 at 16:34
  • Falsely, I have merged something wrong into a branch. And the branch was already not up-to-date. So I should have the latest version now to make further pull requests. If possible, I would gladly like to delete only this one branch and 're-fork' it again. – TheMe Dec 09 '17 at 21:14

1 Answers1

0

No need to 're-fork' (that's even not possible to fork only one branch).

The thing you have to do, if you already have not done it, is to add the upstream repository as a remote.

Then fetch from this remote. You will have the commits you lost. Then fix your branch (using a 'git reset --hard'. Beware of lost data! ) and push it to your forked repository (that should be your 'origin' remote).

Philippe
  • 28,207
  • 6
  • 54
  • 78
  • How can I do this? Actually nothing works. It's ok to lose data, but only on this branch. All other branches should be untouched. – TheMe Dec 09 '17 at 21:37