git/list[1] front-page[2] threads[3] people[4] search[5] about
 

force "unmerged" for same-file auto-merges

From
NKNeal Kreitzinger <neal@rsss.com>
Date
Mar 24, 2010, 01:44 UTC
Message-ID
<hobqoc$5h3$1@dough.gmane.org>
Scenario:  "same-file auto-merge":  when two different people change the 
same file in their separate repos.  Their changes do not conflict in the 
sense that they are changes to the same lines.  However, their changes do 
conflict in the sense that the resulting merged logic is incorrect.

Concern: The same-file auto-merge results are overlooked (not reviewed) by the programmer because there is nothing preventing a git-commit immediately after the auto-merge completes.

Desired Solution: Perform same-file auto-merge and produce auto-merge results, but mark all such auto-merged files as "unmerged" so that they must be reviewed/resolved before a git-commit. The "unmerged" status allows git-mergetool to be run (e.g. kdiff3) so that the merged lines can be reviewed. In this way, all auto-merged files are reviewed.

Does anyone know if there are configuration and/or command-line options in git that can accomplish this in a fairly straightforward manner? For example, something like this:

Example config:
$ cat gitconfig
[merge]
            samefileauto = forceconflict

Example command: $ git merge -s sameautoforceconflict branchx

Example results:
$ git merge -s sameautoforceconflict branchx
Merging:
11a99zz examplecommitb
virtual branchx
found 1 common ancestor(s):
22b88yy examplecommita
Auto-merging examplepgm
Merge made by recursive.
 examplepgm |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
$git status
examplepgm: needs merge
# On branch branchx
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working 
directory)
#
#       unmerged:   examplepgm
#
no changes added to commit (use "git add" and/or "git commit -a")

v/r, Neal

Next: Neal Kreitzinger
Message 1 of 5 in “force "unmerged" for same-file auto-merges”
  1. Neal KreitzingerMar 24, 2010
  2. Neal KreitzingerMar 26, 2010
  3. Dilip MMar 27, 2010
  4. Junio C HamanoMar 26, 2010
  5. Sitaram ChamartyMar 27, 2010

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.