{"thread":{"id":"26895","subject":"How to tell what paths changed in a merge?","startedAt":"2011-03-28T19:48:01Z","lastAt":"2011-03-29T02:15:53Z","messageCount":4,"participants":["Patrick Doyle","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"164486","messageId":"AANLkTi=DOf0beuts8TO0c5JJtDtjNAcQ_4hcKNkZoXjM@mail.gmail.com","threadId":"26895","inReplyTo":null,"subject":"How to tell what paths changed in a merge?","fromName":"Patrick Doyle","fromEmail":"wpdster@gmail.com","sentAt":"2011-03-28T19:48:01Z","receivedAt":"2011-03-28T19:48:01Z","isPatch":false,"sender":{"key":"wpdster@gmail.com","avatar":null},"body":"I have a situation where somebody got confused while trying to\ncommit/push/pull from the repository and some changes to some files\ngot lost.\n\nHow can I tell which files got selected in a merge?\n\nI have a log file such as shown below (produced by \"git log\n--full-history --name-status --parents --dense\")\n\nI know that commit 693a2 had the correct files, but 1e5e6 does not.\n(It has an older version of the file).\n\nSo far, I've noticed  one file that has gone bad in this process, and\nI'm worried that there may be others, so I would like to figure out\nexactly what got changed how at each step of the process.\n\nBut I can't figure out how to tell git-log to tell me which files it\nkept when merges occurred.\n\nAny thoughts/tips/advice?\n\nThanks...\n\n--wpd\n\ncommit 1e5e614e9d27902af6e1edb6ddbbca224acf3de2\n693a25dc0dadfcc13786051fed9d066dac4e088c\n6b1747651d06b69f96337633e785808422ed1754\nMerge: 693a25d 6b17476\nAuthor: Shawn Kelly <skkelly@mit.edu>\nDate:   Fri Mar 25 14:39:01 2011 -0400\n\n    Merge branch 'master' of skkbri2:bri2\n\ncommit 693a25dc0dadfcc13786051fed9d066dac4e088c\n8da5a19daa298f87307d168c82b8b023bfe2ac58\n63252fcde7ee61c06e65cd8036cec8e73d529f1c\nMerge: 8da5a19 63252fc\nAuthor: Shawn Kelly <skkelly@mit.edu>\nDate:   Fri Mar 25 14:36:02 2011 -0400\n\n    layout merge\n\ncommit 6b1747651d06b69f96337633e785808422ed1754\n63252fcde7ee61c06e65cd8036cec8e73d529f1c\nAuthor: Shawn Kelly <skkelly@mit.edu>\nDate:   Wed Mar 23 19:12:27 2011 -0400\n\n    acwtgtvss1a\n\nA       oalib/bri2/acwtgtvss1a/constraint/hierDesign.oa\nA       oalib/bri2/acwtgtvss1a/constraint/master.tag\nA       oalib/bri2/acwtgtvss1a/constraint/prop.cfg\nA       oalib/bri2/acwtgtvss1a/layout/layout.oa\nA       oalib/bri2/acwtgtvss1a/layout/master.tag\nA       oalib/bri2/acwtgtvss1a/symbol/master.tag\nA       oalib/bri2/acwtgtvss1a/symbol/symbol.oa\n\ncommit 63252fcde7ee61c06e65cd8036cec8e73d529f1c\ndbe78c36bd1440ad537c8e55c915cb30073cbf54\n18245190b4ae4c21a301d58a02d7c1d969a7700b\nMerge: dbe78c3 1824519\nAuthor: Shawn Kelly <skkelly@mit.edu>\nDate:   Wed Mar 23 18:59:33 2011 -0400\n\n    Merge branch 'master' of wfebri2:bri2\n\ncommit 8da5a19daa298f87307d168c82b8b023bfe2ac58\n25316a8ef872508934a68916c27bc1e17dcdbe0e\nAuthor: Shawn Kelly <skkelly@mit.edu>\nDate:   Wed Mar 23 18:57:06 2011 -0400\n"},{"id":"164488","messageId":"20110328202039.GA27755@sigill.intra.peff.net","threadId":"26895","inReplyTo":"AANLkTi=DOf0beuts8TO0c5JJtDtjNAcQ_4hcKNkZoXjM@mail.gmail.com","subject":"Re: How to tell what paths changed in a merge?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-03-28T20:20:39Z","receivedAt":"2011-03-28T20:20:39Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Mar 28, 2011 at 03:48:01PM -0400, Patrick Doyle wrote:\n\n> I have a situation where somebody got confused while trying to\n> commit/push/pull from the repository and some changes to some files\n> got lost.\n> \n> How can I tell which files got selected in a merge?\n\nI'm not exactly sure what you mean by \"selected\". A merge commit is a\ntree state with two parent commits. So you can look at what's different\nin the merged state versus either parent, or there are some special ways\nof looking at it all together.\n\nYou might want to try:\n\n  # show a \"combined diff\"; lines with +/- in the first column came from\n  # the first parent of the merge (i.e., where you were when you ran\n  # \"git merge\" or \"git pull\"). The ones in the second column came from\n  # the second parent (the thing you merged).\n  git show -c 1e5e614\n\n  # show a condensed combined diff; this is like \"-c\", except that it\n  # eliminates \"uninteresting\" hunks, where the merge took the entire\n  # hunk from one parent.\n  git show --cc 1e5e614\n\n  # show the diff of the merge commit to each of its parents\n  # individually\n  git show -m 1e5e614\n\nAnd of course you can use those options with \"git log -p\" to see all of\nthe commits and what they did. You might also want to try \"git log\n--graph\" to show the structure (though it is pretty hard to read with\nthe diffs included).\n\n> I have a log file such as shown below (produced by \"git log\n> --full-history --name-status --parents --dense\")\n\nDoesn't --dense cancel out --full-history?\n\n> I know that commit 693a2 had the correct files, but 1e5e6 does not.\n> (It has an older version of the file).\n\nSounds like somebody botched the conflict resolution. Using the show\ncommands above should show you what happened in that case. Though from\nthe commit messages below, I don't see any mention of conflicts, which\nthe merge should have put in the message automatically.\n\nSo it may be that the files simply didn't change in first parent branch,\nbut somebody reverted them to old versions (or botched a different\nmerge) in the merged-in branch, with the end effect of reverting during\nthe merge.\n\nIf you're still confused after looking around more, and there is nothing\nsecret in the repo, it might work to make the repo available and tell us\nwhat you expected to see in 1e5e6, and how it differed.\n\n-Peff\n"},{"id":"164518","messageId":"AANLkTikRSv6Y4GGV5Qx_5MXUQx-7SAXq8gGz0w7hbfa5@mail.gmail.com","threadId":"26895","inReplyTo":"AANLkTi=vB4CsMZ_hT-Mruqs6tiEjUgEzbA2Vwaog6wNK@mail.gmail.com","subject":"Fwd: How to tell what paths changed in a merge?","fromName":"Patrick Doyle","fromEmail":"wpdster@gmail.com","sentAt":"2011-03-29T01:50:45Z","receivedAt":"2011-03-29T01:50:45Z","isPatch":false,"sender":{"key":"wpdster@gmail.com","avatar":null},"body":"Oops... I just realized I did a \"Reply\" instead of \"Reply-All\".\n\nIt's been one of those days... sigh.\n\n--wpd\nOn Mon, Mar 28, 2011 at 4:47 PM, Jeff King <peff@peff.net> wrote:\n> On Mon, Mar 28, 2011 at 04:39:03PM -0400, Patrick Doyle wrote:\n>\n>> Thank you for your quick reply...  you are correct in your assessment\n>> that somebody botched a merge.  Probably several of them from several\n>> different working trees.  I am trying to figure out\n>>\n>> a) What he changed how & when\n>>\n>> b) How to politely tell him not to do that again.\n>\n> Heh. You're on your own for (b).\nand I thought this was a full-service list.  Oh well :-)\n\n\n> Have you tried \"git log -p broken-file\"? That should show you everywhere\n> that broken-file was touched (and how). It might make more sense to use\n> \"gitk broken-file\", as I suspect the actual shape of history will be\n> useful in seeing what happened.\nThat's the bizarre thing -- \"git log broken-file\" doesn't show my\nrecent modifications at all, although \"git log shows my commit where I\nlast modified the file (182451), followed (a few commits later) by his\nmerge commit.\n\ngit show 182451:path/to/broken-file\n\nshows my most recent change to the file.\n\nMy commit got merged with one of his at 63252 without any problems.\n\nThat tree got merged with another one of his (from a different working\ndirectory) at 693a2 and, for some reason, my original file shows up\nfrom there on forward.\n\nI think he probably did a \"git pull\" which failed (most of our\nrepository is binary CAD files, unfortunately), he probably uttered a\nfew choice words, threw things around the room, and then grabbed his\nsledgehammer to force things back into the shape he wanted, and failed\nto notice that he left some dents in other places.\n\nI think I'm gonna have to just go back and review each of his merge\ncommits manually, compare the tree on one side to the tree on the\nother, and figure out what got changed.\n\nIt's confusing to me that I can't figure out the right options to\ngit-log to make this easier.  \"git log --name-status 693a2\" doesn't\nlist any files as having changed.  I don't know what he did to force\nthe immediate ancestor of the file I changed to be re-committed to the\nrepository, but somehow he did that.\n\nMy biggest concern is to wonder what else got stomped on as he wielded\nhis sledgehammer.\n\nI just noticed your suggestion about \"gitk broken-file\".  I think I'll\ngo give that a shot and see what I can learn from that.\n--wpd\n"},{"id":"164522","messageId":"AANLkTi=wRunp2KG94MQEvMDp+GM9uiZybM4LrUVOrAti@mail.gmail.com","threadId":"26895","inReplyTo":"20110329014814.GA4696@sigill.intra.peff.net","subject":"Re: How to tell what paths changed in a merge?","fromName":"Patrick Doyle","fromEmail":"wpdster@gmail.com","sentAt":"2011-03-29T02:15:53Z","receivedAt":"2011-03-29T02:15:53Z","isPatch":false,"sender":{"key":"wpdster@gmail.com","avatar":null},"body":"On Mon, Mar 28, 2011 at 9:48 PM, Jeff King <peff@peff.net> wrote:\n> Try \"git log -c --name-status\" and \"git log -m --name-status\" to show\n> the \"combined\" name-status and separate per-parent name-status\n> respectively. Our default is not to show very much for merges, because\n> it's a little more expensive to calculate and in the normal case, it\n> ends up not being very interesting. Your case is not normal. :)\n>\n$ git log -m --name-status\n\nlooks like it will tell me what I'm looking for... (tomorrow when I'm\nmore awake and in better shape to try tackling this).\n\nThanks for your help.\n\n--wpd\n"}]}