[英]How do I merge the master repo's changes to my own?
I'm new to Github and I am modifying an existing WP plugin. 我是Github新手,正在修改现有的WP插件。 I forked the "master" branch into what I believe can now be called my repo. 我将“ master”分支分支到了我认为现在可以称为我的回购协议的分支中。 That all seemed fine. 一切似乎都很好。
I was making changes to the files on notepad++ but now the author has released some changes. 我正在对notepad ++上的文件进行更改,但是现在作者发布了一些更改。
Is it possible to upload the entire plugin to my repo? 是否可以将整个插件上传到我的仓库中?
After that, can I merge the author's changes into mine without deleting all the changes I made? 之后,我可以在不删除我所做的所有更改的情况下将作者的更改合并到我的更改中吗?
You have two options, neither of which will guarantee that you won't have conflicts: 您有两种选择,但这两种都不保证您不会发生冲突:
1) Run a git stash
to save your changes. 1)运行git stash
保存更改。 Then checkout out master
and pull so you get the other developer's changes. 然后签出master
并拉出,以便获得其他开发人员的更改。 Go back to your feature branch git rebase master
and then git stash pop
to reapply your changes on top of the other developer's work. 返回到您的功能分支git rebase master
,然后返回git stash pop
以在其他开发人员的工作之上重新应用您的更改。 Resolve any conflicts and continue. 解决任何冲突,然后继续。
2) The other option is pretty much the same but rather than stashing your changes you commit your work before rebasing with master. 2)另一个选项几乎是相同的,但是您不必保存更改,而是在与master协作之前提交了工作。 It depends really on the nature of the work, whether you need to make use of the other developer's changes on which option you go for. 这实际上取决于工作的性质,是否需要在选择哪个选项时利用其他开发人员的更改。 If your changes are pretty isolated then the latter option may be preferred. 如果您所做的更改非常孤立,则首选后一种选项。
You can merge master into your feature branch but this isn't as "nice" an option. 您可以将master合并到功能分支中,但这不是“不错”的选择。 You can see the difference between the two here: https://www.atlassian.com/git/tutorials/merging-vs-rebasing 您可以在这里看到两者之间的区别: https : //www.atlassian.com/git/tutorials/merging-vs-rebasing
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.