【发布时间】:2018-11-29 02:44:29
【问题描述】:
我有以下情况:
Remote: A<-B<-----C<-D<-------\
Local: \-B1<------B2<-B3<-M
因此,我已将远程拉取合并到本地存储库 (M) 中。我现在想恢复 B3 并返回 B2。 我试着做一个
git revert --no-commit -m 1 M
git revert --continue
现在我的 git 日志显示如下:
commit R
Revert "Merge branch 'master' of https://...."
This reverts commit M, reversing changes made to B3
commit M
....
commit B3
....
....
然而,即使 git 日志提到“reversing changes made to B3”,当我执行 git status 时,它显示的内容与我期望的相同在 B3 提交之后. 看来,我实际上是向前而不是向后(新提交 R)。
我的问题:
- 如何返回 B2?
- 恢复合并是正确的做法/需要吗?
【问题讨论】:
-
git 重置,git 合并?
-
或者 git checkout?
标签: git git-commit git-revert