克隆后无法立即 git 恢复到较旧的提交(未进行任何更改)
我需要测试 github 上一些代码的旧版本(提交)。我做了 git clone ,然后
git revert $id
&id 是我需要检查的版本的 id 。我收到此错误:
error: could not revert 9a0d90d... Version 1.2.1
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
克隆后我没有对任何文件进行任何更改。
我做错了什么?
I need to test an older version (commit) of some code from github. I made git clone and then
git revert $id
where &id was id of the version that i need to check. I got this error:
error: could not revert 9a0d90d... Version 1.2.1
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
I made no changes to any files after clone.
What am i doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想测试旧版本,您应该直接从您的旧 ID 创建一个分支
git revert
尝试计算一个新的提交,该提交将取消自$id
以来引入的更改。计算负合并时可能会发生冲突。您不需要它来咨询/测试旧版本。
如果您需要在该测试的上下文中进行任何更改,您将已经处于“
test
”分支中。If you any to test an older version, you should create a branch directly from your older id
git revert
tries to compute a new commit which would cancel changes introduced since$id
. Conflicts can occurs when computing the negative merge.You don't need that for consulting/testing an older revision.
And if you need to make any changes in the context of that test, you will already be in a '
test
' branch.