{"thread":{"id":"10680","subject":"git-merge ignore specific files","startedAt":"2007-11-06T12:38:35Z","lastAt":"2007-11-06T13:46:35Z","messageCount":5,"participants":["Bill Priest","Andreas Ericsson","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"58534","messageId":"174134.11501.qm@web55007.mail.re4.yahoo.com","threadId":"10680","inReplyTo":null,"subject":"git-merge ignore specific files","fromName":"Bill Priest","fromEmail":"priestwilliaml@yahoo.com","sentAt":"2007-11-06T12:38:35Z","receivedAt":"2007-11-06T12:38:35Z","isPatch":false,"sender":{"key":"priestwilliaml@yahoo.com","avatar":null},"body":"All,\n  I have two branches that are slightly different and\nmost changes \"belong\" in both.  There are a handful of\nfiles/directories that are disparate.  Is there any\nway in git to tell it not to merge these files?  Kind\nof like .gitignore but for merges.\n  In addition I'd like a way to specify to git-merge\nto leave all merged files unrecorded in the index. \nThen as I go through each file making sure that the\nmerge \"makes sense\" (not that git did the right thing;\nbut that I want the changes in both branches) that I\nadd the change to the index.\n  I'm sure that I'm probably using git \"incorrectly\"\nand I welcome suggestions for modifying my workflow to\na git style.\n\nAny and all suggestions greatly appreciated,\n\nBill\n\n\n__________________________________________________\nDo You Yahoo!?\nTired of spam?  Yahoo! Mail has the best spam protection around \nhttp://mail.yahoo.com \n"},{"id":"58536","messageId":"473063C1.7070607@op5.se","threadId":"10680","inReplyTo":"174134.11501.qm@web55007.mail.re4.yahoo.com","subject":"Re: git-merge ignore specific files","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2007-11-06T12:53:21Z","receivedAt":"2007-11-06T12:53:21Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Bill Priest wrote:\n> All,\n>   I have two branches that are slightly different and\n> most changes \"belong\" in both.  There are a handful of\n> files/directories that are disparate.  Is there any\n> way in git to tell it not to merge these files?  Kind\n> of like .gitignore but for merges.\n>   In addition I'd like a way to specify to git-merge\n> to leave all merged files unrecorded in the index. \n> Then as I go through each file making sure that the\n> merge \"makes sense\" (not that git did the right thing;\n> but that I want the changes in both branches) that I\n> add the change to the index.\n>   I'm sure that I'm probably using git \"incorrectly\"\n> and I welcome suggestions for modifying my workflow to\n> a git style.\n> \n> Any and all suggestions greatly appreciated,\n> \n\n\nAt a cursory glance at the sources, it looks as if you should be able to\nget what you want with pretty small modifications to builtin-read-tree.c\nand git-merge.sh.\n\nSpecifically, 'git read-tree' (which does the heavy lifting during merges)\ntakes --exclude-per-directory as an argument. You want to teach 'git merge'\nto do the same and pass that argument along to 'git read-tree'. Then it's\njust a matter of maintaining two sets of .gitignore files, one of which\nyou'd probably want to call .mergeignore (or something) and make sure you\ndon't forget to pass that option when you merge (although I assume you'd\nnotice if you'd forgotten it during conflict resolution).\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"58537","messageId":"fgpong$fmn$1@ger.gmane.org","threadId":"10680","inReplyTo":"174134.11501.qm@web55007.mail.re4.yahoo.com","subject":"Re: git-merge ignore specific files","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-11-06T13:03:45Z","receivedAt":"2007-11-06T13:03:45Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Bill Priest wrote:\n\n> All,\n>   I have two branches that are slightly different and\n> most changes \"belong\" in both.  There are a handful of\n> files/directories that are disparate.  Is there any\n> way in git to tell it not to merge these files?  Kind\n> of like .gitignore but for merges.\n\nMost probably you can use gitattributes for that.\nOr you can use 'our' merge strategy.\n\n>   In addition I'd like a way to specify to git-merge\n> to leave all merged files unrecorded in the index. \n> Then as I go through each file making sure that the\n> merge \"makes sense\" (not that git did the right thing;\n> but that I want the changes in both branches) that I\n> add the change to the index.\n\nYou can use gitattributes for that.\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"58538","messageId":"323303.75335.qm@web55010.mail.re4.yahoo.com","threadId":"10680","inReplyTo":"fgpong$fmn$1@ger.gmane.org","subject":"Re: git-merge ignore specific files","fromName":"Bill Priest","fromEmail":"priestwilliaml@yahoo.com","sentAt":"2007-11-06T13:15:15Z","receivedAt":"2007-11-06T13:15:15Z","isPatch":false,"sender":{"key":"priestwilliaml@yahoo.com","avatar":null},"body":"\n--- Jakub Narebski <jnareb@gmail.com> wrote:\n\n> Bill Priest wrote:\n> \n> > All,\n> >   I have two branches that are slightly different\n> and\n> > most changes \"belong\" in both.  There are a\n> handful of\n> > files/directories that are disparate.  Is there\n> any\n> > way in git to tell it not to merge these files? \n> Kind\n> > of like .gitignore but for merges.\n> \n> Most probably you can use gitattributes for that.\n> Or you can use 'our' merge strategy.\n\nCan you point me to some docs on \"our\" merge strategy?\n\n> \n> >   In addition I'd like a way to specify to\n> git-merge\n> > to leave all merged files unrecorded in the index.\n> \n> > Then as I go through each file making sure that\n> the\n> > merge \"makes sense\" (not that git did the right\n> thing;\n> > but that I want the changes in both branches) that\n> I\n> > add the change to the index.\n> \n> You can use gitattributes for that.\n\nI did man gitattributes and nothing jumped out at me\nas far as an attribute that I could set/unset that\nwould stop a file from being merged.  What am I\nmissing?\n\nBill\n \n\n\n__________________________________________________\nDo You Yahoo!?\nTired of spam?  Yahoo! Mail has the best spam protection around \nhttp://mail.yahoo.com \n"},{"id":"58539","messageId":"200711061446.36336.jnareb@gmail.com","threadId":"10680","inReplyTo":"323303.75335.qm@web55010.mail.re4.yahoo.com","subject":"Re: git-merge ignore specific files","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-11-06T13:46:35Z","receivedAt":"2007-11-06T13:46:35Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Bill Priest wrote:\n> Jakub Narebski <jnareb@gmail.com> wrote:\n>> Bill Priest wrote:\n>> \n>>> All,\n>>>   I have two branches that are slightly different and\n>>> most changes \"belong\" in both.  There are a handful of\n>>> files/directories that are disparate.  Is there any\n>>> way in git to tell it not to merge these files? Kind\n>>> of like .gitignore but for merges.\n>> \n>> Most probably you can use gitattributes for that.\n>> Or you can use 'our' merge strategy.\n> \n> Can you point me to some docs on \"our\" merge strategy?\n\ngit-merge(1), section \"Merge strategies\":\n\n  ours::\n        This resolves any number of heads, but the result of the\n        merge is always the current branch head.  It is meant to\n        be used to supersede old development history of side\n        branches.\n\n>>>   In addition I'd like a way to specify to git-merge\n>>> to leave all merged files unrecorded in the index.\n>>> Then as I go through each file making sure that the\n>>> merge \"makes sense\" (not that git did the right thing;\n>>> but that I want the changes in both branches) that\n>>> I add the change to the index.\n>> \n>> You can use gitattributes for that.\n> \n> I did man gitattributes and nothing jumped out at me\n> as far as an attribute that I could set/unset that\n> would stop a file from being merged.  What am I\n> missing?\n\nSee `diff' and `merge' attributes, for example\n\n*.nbi\t\t-diff -merge\n\n-- \nJakub Narebski\nPoland\n"}]}