简体   繁体   English

如何将主存储库的更改合并到我自己的更改?

[英]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 ++上的文件进行更改,但是现在作者发布了一些更改。

  1. Is it possible to upload the entire plugin to my repo? 是否可以将整个插件上传到我的仓库中?

  2. 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.

相关问题 如何将 git fork 的更改合并到我的 repo 的 master 中? - How do I merge changes of a git fork into master of my repo? 如何在一个git commit中将master分支的更改合并到我的side project分支中? - How do I merge a master branch's changes into my side project branch in one git commit? 自分支首次创建以来,如何保持Git中的合并不会覆盖我所有主服务器的更改? - How do I keep merge in Git from overwriting all my master's changes since the branch was first created? 如何使Araxis Merge中的更改应用于我的存储库中的相应文件? - How do I cause changes in Araxis Merge to apply to the corresponding files in my repo? 在Git中,如何使我当前的分支master或将其合并为master但强制它接受我的所有更改 - In Git how do make my current branch master or merge it to master but force it to accept all my changes Bitbucket:更新一个分支以合并主存储库的更改? - Bitbucket: Update a fork to merge changes of master repo? 如何将远程存储库与当前现有目录合并? - How do I merge a remote repo with my current existing directory? 如何将 cloud_firestore 插件的主仓库版本(在 flutterfire 包中)添加到我的应用程序的 pubspec.yaml? - How do i add the master repo version of cloud_firestore plugin (inside flutterfire package) to my app's pubspec.yaml? 如何在不更改主存储库的情况下在本地将我的存储库恢复到其原始 state? - How do i restore my repo to its original state locally without changing the master repo? 如何将分支合并到主分支的子文件夹中? - How do I merge a branch into a subfolder of my master branch?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM