使用一个简单的例子,提交 A
、B
、C
、D
都是有序的(没有奇怪的树结构),并且鉴于我有 A
和 D
的 SHA
,我正在使用 git show
像这样:
git show --no-patch --abbrev-commit --abbrev=7 --format=short A D
这为我提供了提交 A
、B
、C
和 D
。但我想获得比 A
(A
除外)更新的版本。我不知道 B
和 C
的 SHA
,我希望我可以修改我的修订规范而无需创建第二次调用 git。
这可能吗?我查看了 gitrevisions,但找不到任何适用的内容。 A^
和A~1
走错了方向。
我的用例是查找将要部署的更改,所以我有上次部署的 git SHA
。
最佳答案
git show A..D
This set operation appears so often that there is a shorthand for it. When you have two commits r1 and r2 (named according to the syntax explained in SPECIFYING REVISIONS above), you can ask for commits that are reachable from r2 excluding those that are reachable from r1 by ^r1 r2 and it can be written as r1..r2.
关于git - 使用 git show 获取比给定修订更新的更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30949259/