* How to tell what paths changed in a merge?
@ 2011-03-28 19:48 Patrick Doyle
2011-03-28 20:20 ` Jeff King
0 siblings, 1 reply; 4+ messages in thread
From: Patrick Doyle @ 2011-03-28 19:48 UTC (permalink / raw)
To: git
I have a situation where somebody got confused while trying to
commit/push/pull from the repository and some changes to some files
got lost.
How can I tell which files got selected in a merge?
I have a log file such as shown below (produced by "git log
--full-history --name-status --parents --dense")
I know that commit 693a2 had the correct files, but 1e5e6 does not.
(It has an older version of the file).
So far, I've noticed one file that has gone bad in this process, and
I'm worried that there may be others, so I would like to figure out
exactly what got changed how at each step of the process.
But I can't figure out how to tell git-log to tell me which files it
kept when merges occurred.
Any thoughts/tips/advice?
Thanks...
--wpd
commit 1e5e614e9d27902af6e1edb6ddbbca224acf3de2
693a25dc0dadfcc13786051fed9d066dac4e088c
6b1747651d06b69f96337633e785808422ed1754
Merge: 693a25d 6b17476
Author: Shawn Kelly <skkelly@mit.edu>
Date: Fri Mar 25 14:39:01 2011 -0400
Merge branch 'master' of skkbri2:bri2
commit 693a25dc0dadfcc13786051fed9d066dac4e088c
8da5a19daa298f87307d168c82b8b023bfe2ac58
63252fcde7ee61c06e65cd8036cec8e73d529f1c
Merge: 8da5a19 63252fc
Author: Shawn Kelly <skkelly@mit.edu>
Date: Fri Mar 25 14:36:02 2011 -0400
layout merge
commit 6b1747651d06b69f96337633e785808422ed1754
63252fcde7ee61c06e65cd8036cec8e73d529f1c
Author: Shawn Kelly <skkelly@mit.edu>
Date: Wed Mar 23 19:12:27 2011 -0400
acwtgtvss1a
A oalib/bri2/acwtgtvss1a/constraint/hierDesign.oa
A oalib/bri2/acwtgtvss1a/constraint/master.tag
A oalib/bri2/acwtgtvss1a/constraint/prop.cfg
A oalib/bri2/acwtgtvss1a/layout/layout.oa
A oalib/bri2/acwtgtvss1a/layout/master.tag
A oalib/bri2/acwtgtvss1a/symbol/master.tag
A oalib/bri2/acwtgtvss1a/symbol/symbol.oa
commit 63252fcde7ee61c06e65cd8036cec8e73d529f1c
dbe78c36bd1440ad537c8e55c915cb30073cbf54
18245190b4ae4c21a301d58a02d7c1d969a7700b
Merge: dbe78c3 1824519
Author: Shawn Kelly <skkelly@mit.edu>
Date: Wed Mar 23 18:59:33 2011 -0400
Merge branch 'master' of wfebri2:bri2
commit 8da5a19daa298f87307d168c82b8b023bfe2ac58
25316a8ef872508934a68916c27bc1e17dcdbe0e
Author: Shawn Kelly <skkelly@mit.edu>
Date: Wed Mar 23 18:57:06 2011 -0400
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to tell what paths changed in a merge?
2011-03-28 19:48 How to tell what paths changed in a merge? Patrick Doyle
@ 2011-03-28 20:20 ` Jeff King
[not found] ` <AANLkTinhRTwbU8DXc7sYxmxjKEiHASYmdKqxofmn+wgs@mail.gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Jeff King @ 2011-03-28 20:20 UTC (permalink / raw)
To: Patrick Doyle; +Cc: git
On Mon, Mar 28, 2011 at 03:48:01PM -0400, Patrick Doyle wrote:
> I have a situation where somebody got confused while trying to
> commit/push/pull from the repository and some changes to some files
> got lost.
>
> How can I tell which files got selected in a merge?
I'm not exactly sure what you mean by "selected". A merge commit is a
tree state with two parent commits. So you can look at what's different
in the merged state versus either parent, or there are some special ways
of looking at it all together.
You might want to try:
# show a "combined diff"; lines with +/- in the first column came from
# the first parent of the merge (i.e., where you were when you ran
# "git merge" or "git pull"). The ones in the second column came from
# the second parent (the thing you merged).
git show -c 1e5e614
# show a condensed combined diff; this is like "-c", except that it
# eliminates "uninteresting" hunks, where the merge took the entire
# hunk from one parent.
git show --cc 1e5e614
# show the diff of the merge commit to each of its parents
# individually
git show -m 1e5e614
And of course you can use those options with "git log -p" to see all of
the commits and what they did. You might also want to try "git log
--graph" to show the structure (though it is pretty hard to read with
the diffs included).
> I have a log file such as shown below (produced by "git log
> --full-history --name-status --parents --dense")
Doesn't --dense cancel out --full-history?
> I know that commit 693a2 had the correct files, but 1e5e6 does not.
> (It has an older version of the file).
Sounds like somebody botched the conflict resolution. Using the show
commands above should show you what happened in that case. Though from
the commit messages below, I don't see any mention of conflicts, which
the merge should have put in the message automatically.
So it may be that the files simply didn't change in first parent branch,
but somebody reverted them to old versions (or botched a different
merge) in the merged-in branch, with the end effect of reverting during
the merge.
If you're still confused after looking around more, and there is nothing
secret in the repo, it might work to make the repo available and tell us
what you expected to see in 1e5e6, and how it differed.
-Peff
^ permalink raw reply [flat|nested] 4+ messages in thread
* Fwd: How to tell what paths changed in a merge?
[not found] ` <AANLkTi=vB4CsMZ_hT-Mruqs6tiEjUgEzbA2Vwaog6wNK@mail.gmail.com>
@ 2011-03-29 1:50 ` Patrick Doyle
[not found] ` <20110329014814.GA4696@sigill.intra.peff.net>
1 sibling, 0 replies; 4+ messages in thread
From: Patrick Doyle @ 2011-03-29 1:50 UTC (permalink / raw)
To: git
Oops... I just realized I did a "Reply" instead of "Reply-All".
It's been one of those days... sigh.
--wpd
On Mon, Mar 28, 2011 at 4:47 PM, Jeff King <peff@peff.net> wrote:
> On Mon, Mar 28, 2011 at 04:39:03PM -0400, Patrick Doyle wrote:
>
>> Thank you for your quick reply... you are correct in your assessment
>> that somebody botched a merge. Probably several of them from several
>> different working trees. I am trying to figure out
>>
>> a) What he changed how & when
>>
>> b) How to politely tell him not to do that again.
>
> Heh. You're on your own for (b).
and I thought this was a full-service list. Oh well :-)
> Have you tried "git log -p broken-file"? That should show you everywhere
> that broken-file was touched (and how). It might make more sense to use
> "gitk broken-file", as I suspect the actual shape of history will be
> useful in seeing what happened.
That's the bizarre thing -- "git log broken-file" doesn't show my
recent modifications at all, although "git log shows my commit where I
last modified the file (182451), followed (a few commits later) by his
merge commit.
git show 182451:path/to/broken-file
shows my most recent change to the file.
My commit got merged with one of his at 63252 without any problems.
That tree got merged with another one of his (from a different working
directory) at 693a2 and, for some reason, my original file shows up
from there on forward.
I think he probably did a "git pull" which failed (most of our
repository is binary CAD files, unfortunately), he probably uttered a
few choice words, threw things around the room, and then grabbed his
sledgehammer to force things back into the shape he wanted, and failed
to notice that he left some dents in other places.
I think I'm gonna have to just go back and review each of his merge
commits manually, compare the tree on one side to the tree on the
other, and figure out what got changed.
It's confusing to me that I can't figure out the right options to
git-log to make this easier. "git log --name-status 693a2" doesn't
list any files as having changed. I don't know what he did to force
the immediate ancestor of the file I changed to be re-committed to the
repository, but somehow he did that.
My biggest concern is to wonder what else got stomped on as he wielded
his sledgehammer.
I just noticed your suggestion about "gitk broken-file". I think I'll
go give that a shot and see what I can learn from that.
--wpd
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to tell what paths changed in a merge?
[not found] ` <20110329014814.GA4696@sigill.intra.peff.net>
@ 2011-03-29 2:15 ` Patrick Doyle
0 siblings, 0 replies; 4+ messages in thread
From: Patrick Doyle @ 2011-03-29 2:15 UTC (permalink / raw)
To: Jeff King, git
On Mon, Mar 28, 2011 at 9:48 PM, Jeff King <peff@peff.net> wrote:
> Try "git log -c --name-status" and "git log -m --name-status" to show
> the "combined" name-status and separate per-parent name-status
> respectively. Our default is not to show very much for merges, because
> it's a little more expensive to calculate and in the normal case, it
> ends up not being very interesting. Your case is not normal. :)
>
$ git log -m --name-status
looks like it will tell me what I'm looking for... (tomorrow when I'm
more awake and in better shape to try tackling this).
Thanks for your help.
--wpd
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-03-29 2:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-28 19:48 How to tell what paths changed in a merge? Patrick Doyle
2011-03-28 20:20 ` Jeff King
[not found] ` <AANLkTinhRTwbU8DXc7sYxmxjKEiHASYmdKqxofmn+wgs@mail.gmail.com>
[not found] ` <20110328204750.GA2998@sigill.intra.peff.net>
[not found] ` <AANLkTi=vB4CsMZ_hT-Mruqs6tiEjUgEzbA2Vwaog6wNK@mail.gmail.com>
2011-03-29 1:50 ` Fwd: " Patrick Doyle
[not found] ` <20110329014814.GA4696@sigill.intra.peff.net>
2011-03-29 2:15 ` Patrick Doyle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).