简体   繁体   English

Github推送存储库的本地分支?

[英]Github push a local fork of a repository?

I'm in the following situation: there is a repository "XYZ" on Github which I have a local copy of in a folder "XYZ_local" on my computer (which contains the .git folder and everything). 我遇到以下情况:Github上有一个存储库“XYZ”,我在我的计算机上有一个文件夹“XYZ_local”的本地副本(包含.git文件夹和所有内容)。 The files in "XYZ_local" are several versions behind the "XYZ" repository that's on Github today. “XYZ_local”中的文件是今天在Github上的“XYZ”存储库后面的几个版本。

I've made changes in "XYZ_local" and now I just want to upload it to my own remote Github account such that it appears as a "fork" of the actual "XYZ" repository. 我在“XYZ_local”中进行了更改,现在我只想将其上传到我自己的远程Github帐户,使其显示为实际“XYZ”存储库的“分支”。

How can I do that? 我怎样才能做到这一点?

I think you will have to actually fork the project on github. 我想你必须在github上实际分叉项目。 Like go to the project page and click the fork button. 比如转到项目页面并单击fork按钮。

Then commit your changes and make sure you pull from the current remote. 然后提交您的更改并确保从当前遥控器拉出。 That will integrate your changes with the new commits in the remote. 这将把您的更改与远程中的新提交集成。 After that, remove the remote pointing at XYZ. 之后,移除指向XYZ的遥控器。 git remote remove origin

Then add the new remote to point to your new fork. 然后添加新的遥控器以指向新的分叉。 git remote add origin https://github.com/yourusername/XYZ.git

If you want to keep receiving changes from the remote repository follow these instructions : https://help.github.com/articles/syncing-a-fork/ 如果要继续从远程存储库接收更改,请按照以下说明操作: https//help.github.com/articles/syncing-a-fork/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM