I was working on a branch. But one of the contributors deleted the remote version of the branch. So, I now have a local copy of the code but no remote branch to push to. How do I recreate the remote version?
我在一个分支机构工作。但其中一个贡献者删除了分支的远程版本。所以,我现在有一个代码的本地副本,但没有要推送的远程分支。如何重新创建远程版本?
1 个解决方案
#1
2
First, check to see if the old remote is still in your list:
首先,检查旧遥控器是否仍在列表中:
git remote -v
If it is, and you want to delete it, you do:
如果是,并且您想删除它,则执行以下操作:
git remote rm [remote-name]
... for example.
... 例如。
Now create a new "remote" with the URL of the new repository host:
现在使用新存储库主机的URL创建一个新的“remote”:
git remote add origin [https://github.com/user/repo.git]
Then to push your local branches up to it:
然后推动您的本地分支机构:
git push --all -u
(Replace all the stuff in brackets with the correct info for your repository.)
(用括号中的正确信息替换括号中的所有内容。)
#1
2
First, check to see if the old remote is still in your list:
首先,检查旧遥控器是否仍在列表中:
git remote -v
If it is, and you want to delete it, you do:
如果是,并且您想删除它,则执行以下操作:
git remote rm [remote-name]
... for example.
... 例如。
Now create a new "remote" with the URL of the new repository host:
现在使用新存储库主机的URL创建一个新的“remote”:
git remote add origin [https://github.com/user/repo.git]
Then to push your local branches up to it:
然后推动您的本地分支机构:
git push --all -u
(Replace all the stuff in brackets with the correct info for your repository.)
(用括号中的正确信息替换括号中的所有内容。)