缺少Git更改 [英] Git changes are missing

查看:48
本文介绍了缺少Git更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已使用alm合并请求对一个文件进行了更改.一个月后,我们注意到我们的更改丢失了.

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.

但是,当我们看到提交ID 2e02e42d6b5094809295d375150d13238318968d的日志时.我们可以看到我们的更改已正确合并.提交ID的Git日志

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日志

 git log -p PrePostScripts.xml
commit 1870c07e6b0af5b63f92001f546a58488ee42979
Author: joshua.kesselman <joshua.kesselman@oracle.com>
Date:   Tue Apr 2 13:04:22 2019 -0700

请让我知道如何检查提交2e02e42d6b5094809295d375150d13238318968d发生了什么.

Kindly let me know how to check what happened to the commit 2e02e42d6b5094809295d375150d13238318968d.

推荐答案

在合并提交中请注意以下事项:

Note this in the merge commit:

Merge: 9e108526c5 c75d3cc631

9e108526c5 是合并发生时 develop 分支的HEAD,而 c75d3cc631 是已合并分支的HEAD.通过执行以下操作开始对此进行调查:

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

并调查存储库的状态.正确的更改应该在那里存在.现在,您应该开始进行二等分,以查看哪个提交删除了更改.要启动bisect,请执行以下操作:

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

由于您目前位于c75d3cc631中,并且已在其中进行更改,因此请使用以下命令将其标记为良好":

Since you're currently in c75d3cc631 and the change is there, mark it as good with:

git bisect good

然后切换回HEAD并将其标记为坏,因为那里缺少更改:

Then switch back to HEAD and mark it as bad since the change is missing there:

git checkout develop
git bisect bad

Git现在将在中间自动检出一个提交.查看是否有更改.如果不是,请执行 git bisect bad ,git将会继续.一旦git签出确实存在更改的提交,请执行 git bisect good .继续此过程,直到git告诉您它找出导致该问题的提交为止.

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.

这篇关于缺少Git更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆