git/list[1] front-page[2] threads[3] people[4] search[5] about
wed 2026-10-07 16:59 UTC

Re: Feature request: a merge strategy that makes any file difference a merge conflict

From
Thomas Braun <thomas.braun@virtuell-zuhause.de>
Date
Apr 1, 2024, 11:00 UTC
Message-ID
<17b55da7-42d0-48df-95a6-8433e1c028b0@virtuell-zuhause.de>
In-Reply-To
<CAAJCdQQB3_DWOTCTbb-TAkLUX_XVd5TBd3z0M2_KrHxKxr69Kw@mail.gmail.com>
On 29.03.2024 20:20, Michael Ernst wrote:
[...]
> What do you think of this feature request?

I wanted to propose to mark the relevant files as binary as that should prevent the merge to happen. But this is not working.

git init

echo "*.txt binary" > .gitattributes git add .gitattributes git commit -m ".gitattributes: Add it" .gitattributes

echo "a" > test.txt git add test.txt git commit -m "test.txt: main" test.txt

git checkout -b feature echo "ab" > test.txt git commit -m "test.txt: feature" test.txt

git checkout main git merge --no-ff --stat --no-edit feature

Merge made by the 'ort' strategy.
  test.txt | Bin 22 -> 3 bytes
  1 file changed, 0 insertions(+), 0 deletions(-)
git log -p test.txt
commit ec7cab2fa30c26738c6254202a399a616959a661 (feature)
Author: Thomas Braun <thomas.braun@byte-physics.de>
Date:   Mon Apr 1 12:56:07 2024 +0200
     test.txt: feature
diff --git a/test.txt b/test.txt
index 346a56a..81bf396 100644
Binary files a/test.txt and b/test.txt differ

commit 61e195554351dada7494e4eb4935d96120680420
Author: Thomas Braun <thomas.braun@byte-physics.de>
Date:   Mon Apr 1 12:50:29 2024 +0200

     test.txt: main

diff --git a/test.txt b/test.txt
new file mode 100644
index 0000000..346a56a
Binary files /dev/null and b/test.txt differ

I would have expected to see a merge conflict as git can't know how to 
merge binaries. Or am I misunderstanding something here?
Previous: Michael Ernst
Message 4 of 4 in “Feature request: a merge strategy that makes any file difference a merge conflict”
  1. Michael ErnstMar 29, 2024
  2. Junio C HamanoMar 29, 2024
  3. Michael ErnstMar 29, 2024
  4. Thomas BraunApr 1, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.