Am Mon, 09 Dec 2019 13:04:14 -0800 schrieb Junio C Hamano : > Olaf Hering writes: > > Is there a way to detect (from a script) if the current working tree is in state 'merge'? > The first step is to define what "state 'merge'" is, I think. I do a fresh clone of a remote repository, checkout the target branch, then merge some other branch into it. Usually the 'git status' command gives me a list of files. In case it creates some output, 'git commit' is called. In case there is '^UU' in the output, manual intervention is required prior commit. In this case the resolved conflict resulted in no changes. I do remember a plain 'git status' showed something like 'a merge is going on'. Apparently there is no easy way to get this state from a git command. But as you said I may be able to test for existence of files in the .git directory. I will try to recreate the state to repeat this merge. > Why are you scripting around "git commit"? Doesn't "git commit" > refrain from creating an empty commit when there is nothing to > commit anyway, unless it is recording a merge whose result happens > to be a no-op? 'git commit' errors out if there is nothing to commit. But in this case it would have to create a merge commit. Olaf