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

Re: git-merge ignore specific files

From
Jakub Narebski <jnareb@gmail.com>
Date
Nov 6, 2007, 13:46 UTC
Message-ID
<200711061446.36336.jnareb@gmail.com>
In-Reply-To
<323303.75335.qm@web55010.mail.re4.yahoo.com>
Bill Priest wrote:
Show 14 quoted lines
> Jakub Narebski <jnareb@gmail.com> wrote:
>> Bill Priest wrote:
>> 
>>> All,
>>>   I have two branches that are slightly different and
>>> most changes "belong" in both.  There are a handful of
>>> files/directories that are disparate.  Is there any
>>> way in git to tell it not to merge these files? Kind
>>> of like .gitignore but for merges.
>> 
>> Most probably you can use gitattributes for that.
>> Or you can use 'our' merge strategy.
> 
> Can you point me to some docs on "our" merge strategy?
git-merge(1), section "Merge strategies":
  ours::
        This resolves any number of heads, but the result of the
        merge is always the current branch head.  It is meant to
        be used to supersede old development history of side
        branches.
Show 13 quoted lines
>>>   In addition I'd like a way to specify to git-merge
>>> to leave all merged files unrecorded in the index.
>>> Then as I go through each file making sure that the
>>> merge "makes sense" (not that git did the right thing;
>>> but that I want the changes in both branches) that
>>> I add the change to the index.
>> 
>> You can use gitattributes for that.
> 
> I did man gitattributes and nothing jumped out at me
> as far as an attribute that I could set/unset that
> would stop a file from being merged.  What am I
> missing?
See `diff' and `merge' attributes, for example
*.nbi		-diff -merge
-- 
Jakub Narebski
Poland
Previous: Bill Priest
Message 5 of 5 in “git-merge ignore specific files”
  1. Bill PriestNov 6, 2007
  2. Andreas EricssonNov 6, 2007
  3. Jakub NarebskiNov 6, 2007
  4. Bill PriestNov 6, 2007
  5. Jakub NarebskiNov 6, 2007

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.