取消git merge,但保留本地更改 [英] Cancel git merge but keep local changes
本文介绍了取消git merge,但保留本地更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我开始进行git合并,但进行了要保留的本地更改.我不再想要合并,而是继续处理本地更改.我该怎么做?
I started a git merge, but made local changes that I want to keep. I no longer want to merge, and instead continue to work on the local changes. How do I do this?
推荐答案
语言众所周知是模棱两可的. :-)当您说保持本地变化"时,您可能会意思是:
Language is notoriously ambiguous. :-) When you say "keep local changes" you could mean either:
- 将所有当前更改保留在工作目录中,无论您是手动编辑这些文件还是将它们合并到其中,都将它们合并;或
- 放弃合并带来的任何更改,并保留您引入的所有更改.
这个简单的解决方案解决了第(1)点:
This simple solution addresses point (1):
$ git stash save
$ git stash pop
下面是显示影响的笔录:
Here's a transcript showing the affect:
$ git status
On branch stuff-217/apply-new-config-details
All conflicts fixed but you are still merging. <<<<<< notice this line!
Changes to be committed:
modified: package.json
modified: src/wallabyTest.ts
modified: wallaby.js
$ git stash save
Saved working directory and index state WIP on stuff-217/apply-new-config-details...
$ git status
On branch stuff-217/apply-new-config-details
nothing to commit, working tree clean
$ git stash pop
On branch stuff-217/apply-new-config-details
<<<<<< no longer in the merge!
Changes not staged for commit:
modified: package.json
modified: src/wallabyTest.ts
modified: wallaby.js
这篇关于取消git merge,但保留本地更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文