{"thread":{"id":"43500","subject":"Re: how to ignore merge conflicts?","startedAt":"2006-10-30T19:48:38Z","lastAt":"2006-11-01T07:51:20Z","messageCount":5,"participants":["Linus Torvalds","Len Brown","Shawn Pearce","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"296309","messageId":"200610301448.38222.len.brown@intel.com","threadId":"43500","inReplyTo":null,"subject":"how to ignore merge conflicts?","fromName":"Len Brown","fromEmail":"len.brown@intel.com","sentAt":"2006-10-30T19:48:38Z","receivedAt":"2006-10-30T19:48:38Z","isPatch":false,"sender":{"key":"len.brown@intel.com","avatar":"https://gravatar.com/avatar/a091f34f66caadb51d85a8a496800c6ccae73737e2f45762373e6b8c55fa5dd6?d=mp&s=160"},"body":"Sometimes when a multiple-file merge give conflicts, I don't want to edit\none of the resulting <<<<<=====>>>>> files.\nInstead, I just want to choose the version of that particular file that\nexisted in one of the two merged branches and commit that along with\nthe rest of the merge.\n\nHow to do this?\n\nthanks,\n"},{"id":"296590","messageId":"20061030195325.GB5504@spearce.org","threadId":"43500","inReplyTo":"200610301448.38222.len.brown@intel.com","subject":"Re: how to ignore merge conflicts?","fromName":"Shawn Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-10-30T19:53:25Z","receivedAt":"2006-10-30T19:53:25Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Len Brown <len.brown@intel.com> wrote:\n> Sometimes when a multiple-file merge give conflicts, I don't want to edit\n> one of the resulting <<<<<=====>>>>> files.\n> Instead, I just want to choose the version of that particular file that\n> existed in one of the two merged branches and commit that along with\n> the rest of the merge.\n> \n> How to do this?\n\nYour branch is in stage 2 and the branch you are pulling is in\nstage 3.  So if I ran:\n\n\tgit pull . other\n\nthen my HEAD before the pull is stage 2 and other is stage 3.\n\nYou can use checkout-index to get your version (stage 2) or the\nother version (stage 3):\n\n\tgit checkout-index -f --stage=2 .../path;   # mine\n\tgit checkout-index -f --stage=3 .../path;   # other\n\nthen just make sure you update-index before you commit (git commit\n-a would do the trick too).\n\n-- \n"},{"id":"297649","messageId":"ei5lv0$2jv$1@sea.gmane.org","threadId":"43500","inReplyTo":"200610301448.38222.len.brown@intel.com","subject":"Re: how to ignore merge conflicts?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-10-30T20:06:00Z","receivedAt":"2006-10-30T20:06:00Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Len Brown wrote:\n\n> Sometimes when a multiple-file merge give conflicts, I don't want to edit\n> one of the resulting <<<<<=====>>>>> files.\n> Instead, I just want to choose the version of that particular file that\n> existed in one of the two merged branches and commit that along with\n> the rest of the merge.\n> \n> How to do this?\n\n$ git cat-file -p :<n>:<filename> > <filename>\n$ git update-index <filename>\n\nwhere <n> is one of stages, 1 or 2 to choose one branch version if I\nremember correctly. Check out documentation.\n\nOr just use 'ours' as merge strategy...\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n\n"},{"id":"295144","messageId":"Pine.LNX.4.64.0610301223021.25218@g5.osdl.org","threadId":"43500","inReplyTo":"200610301448.38222.len.brown@intel.com","subject":"Re: how to ignore merge conflicts?","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-10-30T20:29:37Z","receivedAt":"2006-10-30T20:29:37Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Mon, 30 Oct 2006, Len Brown wrote:\n>\n> Sometimes when a multiple-file merge give conflicts, I don't want to edit\n> one of the resulting <<<<<=====>>>>> files.\n> Instead, I just want to choose the version of that particular file that\n> existed in one of the two merged branches and commit that along with\n> the rest of the merge.\n> \n> How to do this?\n\nWell, if you promise not to do what has happened several times before in \npeople who maintained their own CVS trees, for example (which is to just \nignore all merge problems, and force _their_ version, even though the \nreason for the merge problem was that somebody else had fixed a bug, that \nwas now unfixed by the \"merge\"), here's the trivial way to do it:\n\n\tgit checkout HEAD the/file/you/wanted.c\n\n(or, if you want to take it from the source you are merging _from_, just \nuse MERGE_HEAD instead of HEAD).\n\nAnd you're done.\n\n"},{"id":"298109","messageId":"200611010251.20874.len.brown@intel.com","threadId":"43500","inReplyTo":"Pine.LNX.4.64.0610301223021.25218@g5.osdl.org","subject":"Re: how to ignore merge conflicts?","fromName":"Len Brown","fromEmail":"len.brown@intel.com","sentAt":"2006-11-01T07:51:20Z","receivedAt":"2006-11-01T07:51:20Z","isPatch":false,"sender":{"key":"len.brown@intel.com","avatar":"https://gravatar.com/avatar/a091f34f66caadb51d85a8a496800c6ccae73737e2f45762373e6b8c55fa5dd6?d=mp&s=160"},"body":"On Monday 30 October 2006 15:29, Linus Torvalds wrote:\n> \n> On Mon, 30 Oct 2006, Len Brown wrote:\n> >\n> > Sometimes when a multiple-file merge give conflicts, I don't want to edit\n> > one of the resulting <<<<<=====>>>>> files.\n> > Instead, I just want to choose the version of that particular file that\n> > existed in one of the two merged branches and commit that along with\n> > the rest of the merge.\n> > \n> > How to do this?\n> \n> Well, if you promise not to do what has happened several times before in \n> people who maintained their own CVS trees, for example (which is to just \n> ignore all merge problems, and force _their_ version, even though the \n> reason for the merge problem was that somebody else had fixed a bug, that \n> was now unfixed by the \"merge\"), here's the trivial way to do it:\n> \n> \tgit checkout HEAD the/file/you/wanted.c\n> \n> (or, if you want to take it from the source you are merging _from_, just \n> use MERGE_HEAD instead of HEAD).\n> \n> And you're done.\n\nThank you.  This worked, and it is simple enough that I can actually remember it:-)\n\nNo, obviously I wouldn't intentionally blow away a bug  fix.\n\nI believe this scenario is actually quite common, and this action justified.\nIndeed, many years ago Larry McVoy (\"He That Must Not Be Named\" on this list?:-)\nadded commands to the nse-lite merge dialogue at my request to handle exactly this case.\n\nTonight, for example, I merged a big cleanup patch that removed a bunch of\nunnecessary casts from many files, with a branch that includes a complete\nre-write of one of those files.\n\nSo here I chose the re-written version of the file and discarded the cleaned up version\nthat now no longer makes any sense -- while keeping the rest of the cleanup patch\nthat does still make sense.  Yes, key here is knowing that there was not a bugfix\nbundled along in the branch with the cleanup that got thrown away.\n\nthanks,\n-Len\n\nps. Maybe residing at the \"top of the tree\" as you do, other folks do a lot of\n"}]}