git-merge ignore specific files
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.
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.
I'm sure that I'm probably using git "incorrectly"
and I welcome suggestions for modifying my workflow to a git style.
Any and all suggestions greatly appreciated,
Bill
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Quoted 15 lines · Bill Priest
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.
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.
I'm sure that I'm probably using git "incorrectly"
and I welcome suggestions for modifying my workflow to
a git style.
Quoted 2 lines
Any and all suggestions greatly appreciated,
At a cursory glance at the sources, it looks as if you should be able to get what you want with pretty small modifications to builtin-read-tree.c and git-merge.sh.
Specifically, 'git read-tree' (which does the heavy lifting during merges) takes --exclude-per-directory as an argument. You want to teach 'git merge' to do the same and pass that argument along to 'git read-tree'. Then it's just a matter of maintaining two sets of .gitignore files, one of which you'd probably want to call .mergeignore (or something) and make sure you don't forget to pass that option when you merge (although I assume you'd notice if you'd forgotten it during conflict resolution).
Signature · 3 lines
Andreas Ericsson [email protected] OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231
Quoted 6 lines · Bill Priest
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.
Quoted 6 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.
Signature · 3 lines
Jakub Narebski Warsaw, Poland ShadeHawk on #git
Quoted 7 lines · --- Jakub Narebski
Quoted 2 lines · Bill Priest
All,
I have two branches that are slightly differentand
Quoted 1 line
most changes "belong" in both. There are a
handful of
Quoted 8 lines
Quoted 1 line
files/directories that are disparate. Is there
any
Quoted 1 line
way in git to tell it not to merge these files?
Kind
Quoted 1 line
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?
Quoted 6 lines
Quoted 2 lines
In addition I'd like a way to specify to
git-merge
Quoted 3 lines
to leave all merged files unrecorded in the index.
Then as I go through each file making sure that
Quoted 8 lines
the
Quoted 1 line
merge "makes sense" (not that git did the right
thing;
Quoted 1 line
but that I want the changes in both branches) that
I
Quoted 1 line
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?
Bill
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Quoted 10 lines · Bill Priest
Quoted 9 lines · Jakub Narebski
Quoted 6 lines · Bill Priest
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.
Quoted 4 lines
Quoted 2 lines
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.
Quoted 7 lines
Quoted 7 lines
Quoted 6 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.
Quoted 6 lines
Quoted 1 line
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
Signature · 2 lines
Jakub Narebski Poland