Restore master from upstream repo into fork

112 views Asked by At

I accidentally deleted the master branch from my fork. Now I want to reset master in my fork to be as the upstream master.

How do I do this?

1

There are 1 answers

3
Mohanraj On BEST ANSWER

You can create a new master branch by tracking upstream master branch and force push the newly created master branch to you forked repo. The command would be like below,

$ git fetch upstream
$ git checkout -b master --track upstream/master
$ git push <forked-repo-origin> master -f

Please try it out and let me know if you need more.