假设我进行了一些更改:
$ git diff --cached # few changes are stashed
+ change 1 new
blabla
- change 2 old
+ change 2 new
blabla
- change 3 old
+ change 3 new
blabla
$ git diff # no other changes
现在我想快速测试我的程序而无需更改 2。git reset head -p; git stash
我可以完全摆脱更改 2。但是我不想取消它,这只是一个测试,我还是想稍后提交。因此,我想在我的工作目录中进行与更改 2 的更改相反的更改。结果应该是这样的:
$ git diff --cached # 1-3 changes are stashed
+ change 1 new
blabla
- change 2 old
+ change 2 new
blabla
- change 3 old
+ change 3 new
blabla
$ git diff #change 2 is undone
change 1 new
blabla
+ change 2 old
- change 2 new
blabla
change 3 new
blabla
我如何实现这一目标?