简体   繁体   English

Git:合并2变格后,应用于两个对象的隐藏更改

[英]Git: After merge 2 branges the stashed changes applied to both

Is that normal? 那是正常的吗?

Let me explain a bit more.. I have 2 branches, say BranchA and BranchB. 让我解释一下。.我有2个分支,分别是BranchA和BranchB。 I want to merge these 2 branches but i have some changes in BranchA that I want to keep away and revisit, so I stash these files. 我想合并这2个分支,但是我想保留和重新访问BranchA中的一些更改,因此我将这些文件存储起来。 Then I merge A with B (fix conflicts, commit push etc) 然后我将A与B合并(修复冲突,提交推送等)

Then I checkout BranchA again and Stash pop. 然后我再次签出BranchA并隐藏存储。

The result is that now I see these changes as uncommitted changes in both branches!! 结果是现在我将这些更改视为两个分支中未提交的更改! Is that to be expected?? 这是可以预期的吗?

You don't need to use stash, this is what the stage (index) for. 您不需要使用存储,这就是阶段(索引)的作用。 Choose which files or part of files (hunks) to add to the stage and commit them. 选择要添加到阶段并提交的文件或文件的一部分(大块)。

hunks are part of files that you want to add. 块是要添加的文件的一部分。 for example if you have 5 changes to file you can choose to add 0-5 changes (to pick few of them and not all of them). 例如,如果文件有5个更改,则可以选择添加0-5个更改(仅选择其中的一部分,而不选择全部)。

The file system + staging are are Shared between all your branches unless you use git-new-workdir 除非使用git-new-workdir, 否则文件系统和暂存在所有分支之间共享

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

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