0

在开发一个功能时,我有时会隐藏我的更改,当我认为已经完成了很多事情时。

现在我意识到我需要一些我实现、隐藏、然后删除并再次隐藏的代码。所以我目前没有它,但我在我的一个阴影版本中有它。

所以我不能只应用那个隐藏的版本,因为有很多东西我不需要合并。有没有办法手动合并?

基本上,我可以看到当前版本和隐藏版本之间的 git diff:

git diff stash@{n}

但是如何使用合并工具(我通常使用“meld”)进行合并?

“融合”不是必须的。

4

2 回答 2

0

只需执行git stash apply(或pop),它会将更改带入您的工作目录。然后您可以撤消不需要的更改并提交。

于 2015-01-22T13:07:52.373 回答
0

This is fairly simple

  • checkout your branch and make sure there are no unchanged files
  • apply the stash version you need, say n, with "git stash apply stash@{n}"
  • now check the changes, keep the ones you need and remove the others; Meld should work all right here
  • once you are sure you have the subset of changes you need, add and commit all the files

PS: Just to clarify, I think you meant to say using Meld as a diff-tool, and not merge tool. There is no merge happening in the question.

于 2015-01-22T13:15:30.417 回答