How to skip "Hit return to start merge resolution tool" and open mergetool automatically
Asked Answered
S

4

9

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?

Spite answered 23/8, 2013 at 19:58 Comment(1)
Note: the next Git release (2.0.x, Q3 2014) won't display that message anymore if mergetool is defined. See my answer below.Dene
A
8

Use the -y flag. From the documentation:

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

Acro answered 23/8, 2013 at 20:5 Comment(0)
U
12

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
Uther answered 3/6, 2014 at 22:48 Comment(0)
A
8

Use the -y flag. From the documentation:

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

Acro answered 23/8, 2013 at 20:5 Comment(0)
D
1

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.

Dene answered 12/7, 2014 at 20:8 Comment(1)
Merged in github.com/git/git/commit/…Dene
F
0

Add the following lines in your .gitconfig file. Usually, it is at ~/.gitconfig:

[mergetool]
    prompt = false

The above-suggested methods eventually do that. Adding this answer since it helps to know where the command makes the change.

Furie answered 20/9, 2022 at 19:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.