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

Trouble with file specific merge strategies

From
suvayu ali <fatkasuvayu+linux@gmail.com>
Date
Mar 10, 2012, 23:47 UTC
Message-ID
<CAMXnza3SLHWLsFkYLhkJLAwtP2n=QVTXZ__GSL-CvajxC6i0Dw@mail.gmail.com>
Hi git devs,

I have a repo with two branches where some files are absent in one of the branches. Say the two branches are <allfiles> and <somefiles>. Until now I was using

$ git merge -s ours <allfiles> # with <somefiles> checked out

to merge commits which touches the absent files. But this clutters up history and is very inconvenient to do sometimes. So when I came across the possibility of using .gitattributes for file specific merge strategies, I tried the following:

pattern merge=ours
However I get the following conflict message:

CONFLICT (rename/delete): org-mode-config.el deleted in HEAD and renamed in 74288bb. Version 74288bb of org-mode-config.el left in tree.

This file was deleted from <somefiles> in the past[1] and was renamed in <allfiles> since the last merge. I was expecting this file to be ignored (or in other words, merged with ours) since the .gitattributes file has entries like these:

org-mode-config.el merge=ours # new name in allfiles branch lisp/org-mode-settings.el merge=ours # old name deleted in somefiles

I also see other new files in <allfiles> which are mentioned in .gitattributes being merged in <somefiles>.

$ git status -sb ## somefiles M abbrev_defs A cpp-config.el A email-config.el # <-- this should be ignored A gui-config.el # <-- this should be ignored UU init.el A keybindings.el M lisp/skeletons.el D lisp/text-mode-like-settings.el UA org-mode-config.el # <-- this should be ignored A text-mode-config.el

What am I doing wrong here? My git version is 1.7.7.6.
Thanks in advance,
Footnotes:
[1] There has been several successful merges since then.
-- 
Suvayu

Open source is the future. It sets us free.
Next: Junio C Hamano
Message 1 of 7 in “Trouble with file specific merge strategies”
  1. suvayu aliMar 10, 2012
  2. Junio C HamanoMar 11, 2012
  3. suvayu aliMar 11, 2012
  4. Junio C HamanoMar 11, 2012
  5. suvayu aliMar 11, 2012
  6. Thomas HochsteinMar 11, 2012
  7. suvayu aliMar 11, 2012

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.