Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does a commit disappear from the log of one file?

Tags:

git

So I made a change to a file, pushed it to our main repo, saw it there. David pulled from that repo and did -- well, something -- and couldn't see my change. Since David is a typical Microsoft victim, I asked him to push what he had back to the repo and I'd look at it there.

git log --name-only produces

commit 194b7f5dbb59d29ace340a376f10906752978db5
Merge: 484df79 afc2dec
Author: David Good <[email protected]>
Date:   Sat Sep 24 11:47:14 2011 -0700

[ David's merge ]

commit afc2dec4a828de05350c39526eeecf9d3a15e465
Author: Michael <[email protected]>
Date:   Sat Sep 24 10:58:54 2011 -0700

[ my changes ]

backend/theimportantfile.js

commit e4e2f9ce9df3adf5ed0547ed16521eb742cc2ac1
Author: Michael <[email protected]>
Date:   Sat Sep 24 10:47:09 2011 -0700

[ some other thing ]

but git log backend/theimportantfile.js produces

commit eb470fe1792220779b14e90337f74fb216fc9f7f
Author: David Good <[email protected]>
Date:   Mon Sep 12 17:20:25 2011 -0700

[ comment ]

commit 63ddd2be020092a4bf65d1eac106ece5fd7fbbd3
Author: David Good <[email protected]>
Date:   Fri Sep 9 16:23:53 2011 -0700

[ comment ]

So according to git, backend/theimportantfile.js hasn't been touched in weeks but it was also changed two hours ago with the afc2dec commit. How can I track down what happened?

like image 414
Michael Lorton Avatar asked Sep 24 '11 19:09

Michael Lorton


1 Answers

It appears David's merge is what did you in. I say this because that the merge appears to have 'reverted' your changes.

#this command will show you if anything 'strange' happened during the merge"

git show 194b7f

If that command gives no interesting output then David perhaps merged with an 'ours' strategy or did the clever 'cp my files to a temp location; git merge; overwrite conflicting files; git commit' workflow.

Regardless of how this state was arrived at the merge needs to be discarded and redone as it is obviously faulty. You may also consider changing your workflow such that David doesn't need to do merging anymore but rather submites informal (or formal) "pull requests" and you take care of the merging.

like image 83
Frosty Avatar answered Sep 30 '22 21:09

Frosty