Ste*_*ini 15 git version-control git-merge
我正在尝试从devel分支到主服务器的合并壁球.
stefanos-imac:trunk borini$ git merge --squash devel
CONFLICT (content): Merge conflict in test1
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your merge.renamelimit variable to at least 2224 and retry the command.
Squash commit -- not updating HEAD
Automatic merge failed; fix conflicts and then commit the result.
Run Code Online (Sandbox Code Playgroud)
很公平.
stefanos-imac:trunk borini$ git config merge.renameLimit 999999
Run Code Online (Sandbox Code Playgroud)
然后我尝试撤消合并并用更高的限制重做它
stefanos-imac:trunk borini$ git merge --abort
fatal: There is no merge to abort (MERGE_HEAD missing).
Run Code Online (Sandbox Code Playgroud)
好吧,也许我必须按照它说的做,只需重新调用merge命令
stefanos-imac:trunk borini$ git merge --squash devel
fatal: 'merge' is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>' as
appropriate to mark resolution and make a commit, or use 'git commit -a'.
Run Code Online (Sandbox Code Playgroud)
哦,git,你为什么这么混蛋?
更重要的是,有谁知道如何摆脱这种情况?
撤消合并的现代方法是(但这仅在MERGE_HEAD存在时才有效):
git merge --abort
Run Code Online (Sandbox Code Playgroud)
而稍微旧的方式,在这种情况下将起作用(缺少MERGE_HEAD):
git reset --merge
Run Code Online (Sandbox Code Playgroud)
接受回答中描述的老派方式(警告:将丢弃所有本地更改):
git reset --hard
Run Code Online (Sandbox Code Playgroud)
所以请注意,git merge --abort
这只相当于给git reset --merge
定MERGE_HEAD
的存在.这可以在git help for merge命令中读取.
git merge --abort is equivalent to git reset --merge when MERGE_HEAD is present.
Run Code Online (Sandbox Code Playgroud)
合并失败后,如果没有MERGE_HEAD
,则可以撤消失败的合并,git reset --merge
但不一定要撤消git merge --abort
.
归档时间: |
|
查看次数: |
13119 次 |
最近记录: |