{"thread":{"id":"18598","subject":"How do I force git to forget about merging a binary file that is to stay deleted on the target branch?","startedAt":"2009-03-28T05:26:28Z","lastAt":"2009-03-28T15:21:06Z","messageCount":7,"participants":["Brent Goodrick","Nanako Shiraishi","Elijah Newren","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"109687","messageId":"e38bce640903272226l3facf47br9b1849bf708c3881@mail.gmail.com","threadId":"18598","inReplyTo":null,"subject":"How do I force git to forget about merging a binary file that is to stay deleted on the target branch?","fromName":"Brent Goodrick","fromEmail":"bgoodr@gmail.com","sentAt":"2009-03-28T05:26:28Z","receivedAt":"2009-03-28T05:26:28Z","isPatch":false,"sender":{"key":"bgoodr@gmail.com","avatar":"https://gravatar.com/avatar/2399bf5a3468b3516a892183edfd43a7fa0300a2e9d5072189020186961150bc?d=mp&s=160"},"body":"Hi,\n\nHow do I commit a merge but force git to forget about merging one file\nthat I don't want on the target branch, when it is binary, and when it\nwas changed on the source branch, but was deleted on the target branch\n(and should stay deleted on the target branch)?\n\nThe details: I am merging a \"work\" branch into a \"home\" branch.  There\nis one file called \"TimeSheets/Timesheet Exempt.XLS\" that is binary.\nI don't want that file on the \"home\" branch, but do want it on the\n\"work\" branch.  I had made an editing change to that file on the\n\"work\" branch, along with a bunch of other changes I do want to merge\ninto the \"home\" branch. But no matter what I do, I can't force git to\nforget about that \"TimeSheets/Timesheet Exempt.XLS\" file.\n\nI've tried various flavors of git-checkout and git-reset to no\navail. This is what I see at the very last before I gave up:\n\nHere is what I'm left with:\n\n,----\n| $ : gitw status\n| TimeSheets/Timesheet Exempt.XLS: needs merge\n| # On branch home\n| # Changes to be committed:\n| #   (use \"git reset HEAD <file>...\" to unstage)\n| #\n| <snipped out other files I do want to commit>\n| #\n| # Changed but not updated:\n| #   (use \"git add <file>...\" to update what will be committed)\n| #   (use \"git checkout -- <file>...\" to discard changes in working directory)\n| #\n| #\tunmerged:   TimeSheets/Timesheet Exempt.XLS\n| #\n| $ : gitw commit -m \"merge from work\"\n| TimeSheets/Timesheet Exempt.XLS: needs merge\n| TimeSheets/Timesheet Exempt.XLS: unmerged\n(49a49bd9de154daa8ca6cff3cfb550d0dd1b4519)\n| TimeSheets/Timesheet Exempt.XLS: unmerged\n(8de60b8b6827ef1f80921f6d35b574a56683bfdd)\n| error: Error building trees\n`----\n\nAny help anyone can provide is greatly appreciated.\n\nThanks,\nBrent\n"},{"id":"109697","messageId":"20090328192300.6117@nanako3.lavabit.com","threadId":"18598","inReplyTo":"e38bce640903272226l3facf47br9b1849bf708c3881@mail.gmail.com","subject":"Re: How do I force git to forget about merging a binary file that is to stay deleted on the target branch?","fromName":"Nanako Shiraishi","fromEmail":"nanako3@lavabit.com","sentAt":"2009-03-28T10:23:00Z","receivedAt":"2009-03-28T10:23:00Z","isPatch":false,"sender":{"key":"nanako3@lavabit.com","avatar":"https://gravatar.com/avatar/3777b9e201c5883a62b1a6fdf7c53f2d712d1d80989146063ea861e33aad72a8?d=mp&s=160"},"body":"Quoting Brent Goodrick <bgoodr@gmail.com>:\n\n> How do I commit a merge but force git to forget about merging one file\n> that I don't want on the target branch, when it is binary, and when it\n> was changed on the source branch, but was deleted on the target branch\n> (and should stay deleted on the target branch)?\n\nI think the standard answer is \"you don't\".\n\nInstead of using only two branches ('home' and 'work'), you use one common branch (perhaps 'master') that is meant to hold the changes and files that are sharable between two places, and maintain two branches ('home' and 'work') that are forked from the common branch. You treat them as if they are release branches and employ the \"Never merging back\" workflow (see gitster's journal around middle of January this year).\n\nAt home (or at work), you record your changes that are also relevant to the other place to the common branch ('master'), and you record changes that are specific to the location to either 'home' or 'work'. And merge 'master' to 'home' and 'work' as necessary, but never merge 'home' nor 'work' to anything else.\n\n-- \nNanako Shiraishi\nhttp://ivory.ap.teacup.com/nanako3/\n"},{"id":"109703","messageId":"51419b2c0903280547y1bb5664dj70e4e6aa939bd015@mail.gmail.com","threadId":"18598","inReplyTo":"e38bce640903272226l3facf47br9b1849bf708c3881@mail.gmail.com","subject":"Re: How do I force git to forget about merging a binary file that is to stay deleted on the target branch?","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2009-03-28T12:47:38Z","receivedAt":"2009-03-28T12:47:38Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Hi,\n\nOn Fri, Mar 27, 2009 at 11:26 PM, Brent Goodrick <bgoodr@gmail.com> wrote:\n> How do I commit a merge but force git to forget about merging one file\n> that I don't want on the target branch, when it is binary, and when it\n> was changed on the source branch, but was deleted on the target branch\n> (and should stay deleted on the target branch)?\n>\n> The details: I am merging a \"work\" branch into a \"home\" branch.  There\n> is one file called \"TimeSheets/Timesheet Exempt.XLS\" that is binary.\n> I don't want that file on the \"home\" branch, but do want it on the\n> \"work\" branch.  I had made an editing change to that file on the\n> \"work\" branch, along with a bunch of other changes I do want to merge\n> into the \"home\" branch. But no matter what I do, I can't force git to\n> forget about that \"TimeSheets/Timesheet Exempt.XLS\" file.\n>\n> I've tried various flavors of git-checkout and git-reset to no\n> avail. This is what I see at the very last before I gave up:\n\nYou can resolve this merge conflict by running\n$ git rm TimeSheets/Timesheet\\ Exempt.XLS\n\nwhich will make git delete the file from your working copy and the\nindex, at which point you can then make a commit that does not include\nthis file.\n\n\n> Here is what I'm left with:\n>\n> ,----\n> | $ : gitw status\n> | TimeSheets/Timesheet Exempt.XLS: needs merge\n> | # On branch home\n> | # Changes to be committed:\n> | #   (use \"git reset HEAD <file>...\" to unstage)\n> | #\n> | <snipped out other files I do want to commit>\n> | #\n> | # Changed but not updated:\n> | #   (use \"git add <file>...\" to update what will be committed)\n> | #   (use \"git checkout -- <file>...\" to discard changes in working directory)\n> | #\n> | #     unmerged:   TimeSheets/Timesheet Exempt.XLS\n> | #\n> | $ : gitw commit -m \"merge from work\"\n> | TimeSheets/Timesheet Exempt.XLS: needs merge\n> | TimeSheets/Timesheet Exempt.XLS: unmerged\n> (49a49bd9de154daa8ca6cff3cfb550d0dd1b4519)\n> | TimeSheets/Timesheet Exempt.XLS: unmerged\n> (8de60b8b6827ef1f80921f6d35b574a56683bfdd)\n> | error: Error building trees\n> `----\n>\n> Any help anyone can provide is greatly appreciated.\n"},{"id":"109709","messageId":"e38bce640903280729u4f582a19ydaa70f619a9911e1@mail.gmail.com","threadId":"18598","inReplyTo":"20090328192300.6117@nanako3.lavabit.com","subject":"Re: How do I force git to forget about merging a binary file that is to stay deleted on the target branch?","fromName":"Brent Goodrick","fromEmail":"bgoodr@gmail.com","sentAt":"2009-03-28T14:29:24Z","receivedAt":"2009-03-28T14:29:24Z","isPatch":false,"sender":{"key":"bgoodr@gmail.com","avatar":"https://gravatar.com/avatar/2399bf5a3468b3516a892183edfd43a7fa0300a2e9d5072189020186961150bc?d=mp&s=160"},"body":"On Sat, Mar 28, 2009 at 3:23 AM, Nanako Shiraishi <nanako3@lavabit.com> wrote:\n> I think the standard answer is \"you don't\".\n\nThanks, but unfortunately, that won't work for me, since I have too\nmany commits with useful history that would get lost if I started over\nand set up the work and home branches that are branched separately off\nof master.  Also the \"work\" fileset and the \"home\" fileset are 80% the\nsame; its the 20% that causes me puzzlement each time I want to merge\nchanges made on one branch onto the other.\n\nbg\n"},{"id":"109710","messageId":"e38bce640903280746n1cd92a3ft252f18e845abc3db@mail.gmail.com","threadId":"18598","inReplyTo":"51419b2c0903280547y1bb5664dj70e4e6aa939bd015@mail.gmail.com","subject":"Re: How do I force git to forget about merging a binary file that is to stay deleted on the target branch?","fromName":"Brent Goodrick","fromEmail":"bgoodr@gmail.com","sentAt":"2009-03-28T14:46:29Z","receivedAt":"2009-03-28T14:46:29Z","isPatch":false,"sender":{"key":"bgoodr@gmail.com","avatar":"https://gravatar.com/avatar/2399bf5a3468b3516a892183edfd43a7fa0300a2e9d5072189020186961150bc?d=mp&s=160"},"body":"On Sat, Mar 28, 2009 at 5:47 AM, Elijah Newren <newren@gmail.com> wrote:\n> You can resolve this merge conflict by running\n> $ git rm TimeSheets/Timesheet\\ Exempt.XLS\n\nMuch appreciated! That works.\n\nThanks for your and Nanako's help!\n\nbg\n"},{"id":"109711","messageId":"7viqltvg7n.fsf@gitster.siamese.dyndns.org","threadId":"18598","inReplyTo":"51419b2c0903280547y1bb5664dj70e4e6aa939bd015@mail.gmail.com","subject":"Re: How do I force git to forget about merging a binary file that is to stay deleted on the target branch?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-03-28T15:07:24Z","receivedAt":"2009-03-28T15:07:24Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Elijah Newren <newren@gmail.com> writes:\n\n> On Fri, Mar 27, 2009 at 11:26 PM, Brent Goodrick <bgoodr@gmail.com> wrote:\n>> How do I commit a merge but force git to forget about merging one file\n>> that I don't want on the target branch, when it is binary, and when it\n>> was changed on the source branch, but was deleted on the target branch\n>> (and should stay deleted on the target branch)?\n>>\n>> The details: I am merging a \"work\" branch into a \"home\" branch.  There\n>> is one file called \"TimeSheets/Timesheet Exempt.XLS\" that is binary.\n>> I don't want that file on the \"home\" branch, but do want it on the\n>> \"work\" branch.  I had made an editing change to that file on the\n>> \"work\" branch, along with a bunch of other changes I do want to merge\n>> into the \"home\" branch. But no matter what I do, I can't force git to\n>> forget about that \"TimeSheets/Timesheet Exempt.XLS\" file.\n>>\n>> I've tried various flavors of git-checkout and git-reset to no\n>> avail. This is what I see at the very last before I gave up:\n>\n> You can resolve this merge conflict by running\n> $ git rm TimeSheets/Timesheet\\ Exempt.XLS\n>\n> which will make git delete the file from your working copy and the\n> index, at which point you can then make a commit that does not include\n> this file.\n\nBut is this what you really want to do?  After doing such a \"remove it\"\nmerge resolution at Home, wouldn't merging it back to Work remove the\nfile?\n"},{"id":"109713","messageId":"e38bce640903280821k79aa241fqded9fc454e266353@mail.gmail.com","threadId":"18598","inReplyTo":"7viqltvg7n.fsf@gitster.siamese.dyndns.org","subject":"Re: How do I force git to forget about merging a binary file that is to stay deleted on the target branch?","fromName":"Brent Goodrick","fromEmail":"bgoodr@gmail.com","sentAt":"2009-03-28T15:21:06Z","receivedAt":"2009-03-28T15:21:06Z","isPatch":false,"sender":{"key":"bgoodr@gmail.com","avatar":"https://gravatar.com/avatar/2399bf5a3468b3516a892183edfd43a7fa0300a2e9d5072189020186961150bc?d=mp&s=160"},"body":"On Sat, Mar 28, 2009 at 8:07 AM, Junio C Hamano <gitster@pobox.com> wrote:\n>> You can resolve this merge conflict by running\n>> $ git rm TimeSheets/Timesheet\\ Exempt.XLS\n>>\n>> which will make git delete the file from your working copy and the\n>> index, at which point you can then make a commit that does not include\n>> this file.\n>\n> But is this what you really want to do?  After doing such a \"remove it\"\n> merge resolution at Home, wouldn't merging it back to Work remove the\n> file?\n\nYes, and I've not told the full story.  Each time I do a merge in\nbetween the two branches, I have a script that resets certain files\nthat I don't want cross-pollinated between the two branches. Then I do\nthe commit.  Most of the time (on non-binary files, and/or on files I\nonly change on the work branch and not on the home branch), this works\njust fine.\n\nMy desire to avoid doing the above drove my earlier post asking\nwhether there as a facility to exclude certain files from\nparticipating in merges. But the answer was \"no\" to that, hence my ad\nhoc workaround above.\n\nbg\n"}]}