简体   繁体   English

合并分支而没有未提交的更改

[英]Merge branches without uncommitted changes

I was on master branch doing a lot of changes. 我在master分支上做了很多更改。 Right now I'd like to stash those changes, switch branch to dev, and reapply those changes (stash) there. 现在,我想存储这些更改,将分支切换到dev,然后在那里重新应用这些更改(存储)。

I did it, now I am on dev branch having all my uncommitted changes ready for commit. 我做到了,现在我在dev分支上,所有未提交的更改都可以提交了。

But I found out dev branch is not up to date, and I have to merge master into dev, and only then I can commit my changes. 但是我发现dev分支不是最新的,我必须将master合并到dev中,然后我才能提交更改。

The problem is that this merge gives me conflicts. 问题是这种合并给我带来了冲突。 And I can't see what files to merge, because they mix with my uncommitted changes. 而且我看不到要合并的文件,因为它们与我未提交的更改混合在一起。

How can I solve this? 我该如何解决?

Stash your changes again, make sure your dev branch is on latest HEAD . 再次存储您的更改,确保您的dev分支位于最新的HEAD Now merge Master branch into dev branch. 现在将Master分支合并到dev分支。 You do not need to choose files. 您不需要选择文件。 You can choose a commit to merge and it will merge all the change sets until that commit. 您可以选择要合并的提交,它将合并所有变更集,直到该提交为止。 It will only merge those changed files. 它将仅合并那些更改的文件。

Now re-apply your stash. 现在,重新申请您的藏匿处。 It will cause conflicts, on applying stash it will notify the conflicted files. 它将导致冲突,在应用存储时,它将通知冲突的文件。 Now you can easily go through each conflicted file and pick the correct change-set. 现在,您可以轻松浏览每个有冲突的文件,并选择正确的更改集。

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

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