git - 如何获取先前合并到主分支的整个更改列表?
问题描述
我有一个工作分支 WB,我使用 PR 合并到 master。然后我恢复了master中的这些更改。
现在,如果我创建一个新的 PR(WB 到 master),我看不到整个更改列表,只有最后一次提交的最后一次更改,以及完整的提交列表。
如何查看整个更改列表?
谢谢
解决方案
你的情况:
WB got merged here (through PR)
| got reverted here (through another PR maybe ?)
| |
v v
*--*---*-----M--*--R--* <- master
\ /
*--*--* <- WB
正如您在上图中所见,git
现在认为WB
,在其当前状态下,已经合并到master
。
您需要选择一种方法来创建可以带回您想要的更改的内容:
*--*---*-----M--*--R--* <- master
\ / \
*--*--* <- WB *--* <- newWB (with changes)
创建此newWB
分支的一种方法是“revert the revert”:
- 如果还原是在一次提交中完成的:
# create a new branch starting off master :
git checkout -b newWB master
# re-revert the 'R' commit :
git revert R
- 如果还原
R
是合并请求的结果,请使用git revert -m xx
:
# create a new branch starting off master :
git checkout -b newWB master
# revert the merge commit :
git revert -m 1 R
您现在可以推送该新分支并将其合并到master
.
推荐阅读
- git - 如何 git 撤消合并文件
- c# - 程序在没有任何东西的情况下关闭 C#
- html - Flex如何显示保持垂直对齐的项目表
- regex - 尝试匹配以 ly 结尾但不是比较/最高级形式的副词
- drop-down-menu - 如何将下拉按钮中的列表大小固定为数字并使其在颤动中可滚动?
- java - Observer - 围绕电子邮件接收逻辑的可观察模型
- json - 从 JSON 检索值到经典 ASP
- angular - 有没有办法在 Angular 7 中命名路线?
- mysql - UNION ALL LEFT JOIN 和 SUM 返回不正确的值
- selenium - 使用无头时 Selenium 数据目录出错