How to skip “Hit return to start merge resolution tool” and open mergetool automatically

你说的曾经没有我的故事 提交于 2019-12-22 05:13:44

问题


Git asking to hit return button to open the mergetool for each conflict file one by one:

> git mergetool 
Normal merge conflict for '...':
  {local}: modified file
  {remote}: modified file
Hit return to start merge resolution tool (opendiff):

How can I avoid the hitting return step for my project and just open the configured merge tool automatically?


回答1:


Use the -y flag. From the documentation:

-y
--no-prompt
Don’t prompt before each invocation of the merge resolution program.




回答2:


To permanently skip the prompt, run:

git config --global mergetool.prompt false

To skip it for a single run of git mergetool, pass -y or --no-prompt:

git mergetool -y



回答3:


Note: GIt 2.0.x (Q3 2014) won't display that message if you have explicitely defined your merge.tool.
No need for a -y anymore.

See commit 4ecc63d by Felipe Contreras (felipec):

mergetool: run prompt only if guessed tool

It's annoying to see the prompt:

Hit return to start merge resolution tool (foo):

Every time the user does 'git mergetool' even if the user already configured 'foo' as the wanted tool.

Display this prompt only when the user hasn't explicitly configured a tool.

See git-mergetool--lib.sh#L323-L339 for the "explicitly defined" part: git config merge.tool


This is clarified by commit c15bb0c:

-y::
--no-prompt::

Don't prompt before each invocation of the merge resolution program.

This is the default if the merge resolution program is explicitly specified with the --tool option or with the merge.tool configuration variable.

--prompt::

Prompt before each invocation of the merge resolution program to give the user a chance to skip the path.



来源:https://stackoverflow.com/questions/18410889/how-to-skip-hit-return-to-start-merge-resolution-tool-and-open-mergetool-autom

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!