简体   繁体   English

如何使用egit / eclipse配置工作区,以便我的更改进入fork分支

[英]How to configure workspace with egit/eclipse so my changes go to branch on fork

I'm working with a github project that I don't own. 我正在使用我不拥有的github项目。 I originally cloned this project to my Mars.1 workspace for initial examination and debugging. 我最初将此项目克隆到Mars.1工作区中,以进行初始检查和调试。

Note that I posted a similar question to the EGit forum at https://www.eclipse.org/forums/index.php/m/1715162/#msg_1715162 . 请注意,我在https://www.eclipse.org/forums/index.php/m/1715162/#msg_1715162上向EGit论坛发布了类似的问题。

I now know of at least two sets of changes I want to make. 我现在知道至少要进行两组更改。 I've forked the original project in github, and I've created a branch in that fork in github that I intend to implement the first set of changes in. 我在github上创建了原始项目,并在github上的分支中创建了一个分支,打算在其中实现第一组更改。

What's unclear to me at this point is how to configure my Eclipse workspace properly so that my changes that I make now will get committed and pushed into the branch on my fork. 目前我还不清楚如何正确配置Eclipse工作区,以便我现在所做的更改将被提交并推送到我的fork分支中。 I'll eventually submit a PR(s) for these changes, but I'll also be seeding a separate git repo with this resulting codebase. 我最终将针对这些更改提交PR,但是我还将在此生成的代码库中植入单独的git repo。

All I could figure out at this point was creating a remote in eclipse that points to my fork. 我现在只能弄清楚的是创建一个指向我的叉子的日食遥控器。 I only defined the push config at this point, not the fetch config (I'm the only one working on this for now). 我仅在这一点上定义了push配置,而不是fetch配置(我是目前唯一从事此配置的人)。

I don't understand the required next steps. 我不了解所需的后续步骤。 I've read through the EGit user guide, but that isn't helping me answer this question. 我已经阅读了EGit用户指南,但这并不能帮助我回答这个问题。 I've asked about this on non-Eclipse forums, but they all tell me to ignore Eclipse and do it at the command line, or expound for paragraphs on what I apparently don't know about the structure of a git repo. 我曾在非Eclipse论坛上询问过此问题,但它们都告诉我忽略Eclipse,并在命令行中进行操作,或者解释一些我显然不了解git repo结构的段落。

With help from Matthias Sohn on EGit team, I've been able to move forward with this. 在EGit团队的Matthias Sohn的帮助下,我已经能够继续前进。

The key thing I was missing was that I was only setting the "Push" config on the remote. 我缺少的关键是我只在遥控器上设置了“ Push”配置。 The "Fetch" config was more important, ironically. 具有讽刺意味的是,“获取”配置更为重要。 When the remote got the Fetch config, it pulled down the info about my branch, which I was then able to switch to. 当远程服务器获取Fetch配置时,它会拉下有关我的分支的信息,然后我就可以切换到该分支。 I was then able to make my changes, commit, and push to my branch on github. 然后,我可以进行更改,提交并推送到github上的分支。 I also created the PR to the original project. 我还创建了原始项目的PR。

One thing with EGit that made this harder for me to figure out was the difference between creating a "Fetch" config on the Remote on first creation, compared to afterwards, if setting the "Push" config on first creation. 与EGit相比,让我更难弄清楚的是,如果在首次创建时设置“推送”配置,则与在第一次创建时在“远程”上创建“获取”配置之间的区别。 You'll note that when you first create a Remote, you have a choice of setting the "Push" config or the "Fetch" config, but not both. 您会注意到,当您第一次创建Remote时,可以选择设置“ Push”配置或“ Fetch”配置,但不能同时设置两者。 It turns out that if you select the "Fetch" config, it gives you a reasonable default for an initial mapping, but if you create the "Fetch" afterwards, you have to manually create a mapping, and it doesn't suggest the reasonable default. 事实证明,如果选择“获取”配置,它将为您提供合理的初始映射默认值,但是如果您随后创建了“获取”,则必须手动创建映射,但这并不表示合理的配置。默认。

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

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