简体   繁体   English

Git / Github:如何将更改从一个存储库转移到另一个存储库

[英]Git/Github: How to transfer changes from one repository to another

Steps I have made: 我已完成的步骤:

  1. I found a project in Github that I thought I could contribute. 我在Github中找到了一个我可以贡献的项目。
  2. I cloned it directly without creating a Fork. 我直接克隆了它,而没有创建Fork。
  3. I made my changes 我做了改变
  4. Now that I want to upload my changes, I realized that I was not working in a fork. 现在,我要上传所做的更改,我意识到自己并没有进行分叉工作。

How do I manage to upload my changes to the repository of the fork in order to do a Pull Request from the fork to the original repository? 我如何设法将更改上传到派生库中,以便从派生到原始资源库执行“拉取请求”?

Add another git remote with your repo URL and then push to it: 使用您的回购URL添加另一个git remote ,然后将其推送至:

git remote add myrepo git@github.com:your-user/repo
git push myrepo master

You can push to master or to any remote branch you want. 您可以推送至主节点或所需的任何远程分支。

Both repos should share the root tree, which is the case if you have forked it. 两个存储库都应该共享根树,如果您已将其分叉则属于这种情况。

As an alternative, you could change your current origin remote and then push normally to origin : 或者,您可以更改当前的原点遥控器,然后按正常方式推到原点

git remote set-url origin git@github.com:your-user/repo
git push origin master

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

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