简体   繁体   English

在Git上的另一个仓库的分叉中添加个人仓库

[英]Adding a personal repo to fork of another repo on Git

I am working on a collaborative project that I created my own personal repo for. 我正在从事一个协作项目,为此我创建了自己的个人存储库。 I realized that I should have been working out of the fork. 我意识到我应该一直在努力。 I decided to fork and clone the projects down and just drop my project in the fork. 我决定分叉并克隆项目,然后将我的项目放入分叉中。 My role was just to add additional files not related to the original repo. 我的作用只是添加与原始存储库无关的其他文件。 When I push up this version of the updated fork, the repo that I added is grayed out. 当我推送此版本的更新后的fork时,添加的存储库显示为灰色。 I imagine this is because there is no pointer to the source. 我想这是因为没有指向源的指针。 Is there anyway around this? 有没有办法解决? Can I remove all git references with my personal repo code so that I don't get this problem? 我可以使用个人回购代码删除所有git引用,以免出现此问题吗?

Create a new clone of your personal repo. 创建您的个人存储库的新克隆。 In there, delete the .git folder (this will delete all history etc for this clone). 在其中删除.git文件夹(这将删除此克隆的所有历史记录等)。

Next, copy over (on the local filesystem) the .git folder from your local clone of the fork into the local clone of the personal repo. 接下来,将(git)文件夹从分支的本地克隆复制(在本地文件系统上)到个人存储库的本地克隆中。

Now, git will think that your repo is the fork, with the changes you made applied but not yet commited. 现在,git会认为您的存储库是派生的,您所做的更改已应用但尚未提交。 You can create a new commit and push that new commit to the fork. 您可以创建一个新的提交并将该新的提交推送到派生。

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

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