问题
We have committed a change for one file using alm merge request. After one month we have noticed our change is missing.
We tried seeing logs for that file but we don't see our change there as well.
But when we see the logs of commit id 2e02e42d6b5094809295d375150d13238318968d. We can see that our changes got merged properly. Git logs of commit id
git log 2e02e42d6b5094809295d375150d13238318968d
commit 2e02e42d6b5094809295d375150d13238318968d
Merge: 9e108526c5 c75d3cc631
Author: Sreekumar Menon <sreekumar.menon@oracle.com>
Date: Wed Feb 19 11:19:43 2020 -0800
Merge-Request: 12615 from 'users/amit.tiwary/enh30472668' into 'develop'
Git logs of file
git log -p PrePostScripts.xml
commit 1870c07e6b0af5b63f92001f546a58488ee42979
Author: joshua.kesselman <joshua.kesselman@oracle.com>
Date: Tue Apr 2 13:04:22 2019 -0700
Kindly let me know how to check what happened to the commit 2e02e42d6b5094809295d375150d13238318968d.
回答1:
Note this in the merge commit:
Merge: 9e108526c5 c75d3cc631
9e108526c5
was the HEAD of the develop
branch when the merge happened, and c75d3cc631
was the HEAD of the branch that got merged. Start investigating there by doing:
git checkout c75d3cc631
and investigating the state of the repository. The correct change should exist there. You should now start a bisect to see which commit removed the changes. To start the bisect do:
git bisect start
Since you're currently in c75d3cc631 and the change is there, mark it as good with:
git bisect good
Then switch back to HEAD and mark it as bad since the change is missing there:
git checkout develop
git bisect bad
Git will now automatically checkout a commit in the middle. See if the change is there. If not, do git bisect bad
and git will continue. Once git checks out a commit where the change does exist, do git bisect good
. Continue this process until git tells you that it found out which commit was responsible for the problem.
回答2:
In my case one feature branch got merged with develop and over written the changes I have made
来源:https://stackoverflow.com/questions/60863407/git-changes-are-missing