git - 使用 git show 获取比给定修订更新的更改

标签 git

使用一个简单的例子,提交 ABCD 都是有序的(没有奇怪的树结构),并且鉴于我有 ADSHA,我正在使用 git show 像这样:

git show --no-patch --abbrev-commit --abbrev=7 --format=short A D

这为我提供了提交 ABCD。但我想获得比 A(A 除外)更新的版本。我不知道 BCSHA,我希望我可以修改我的修订规范而无需创建第二次调用 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/

相关文章:

linux - 安装 git-svn 会产生依赖项错误

git - 如何自动生成提交信息

git - 将 hg 分支转换为 git 分支?

Github 认证但不允许代码推送

git - stash 命令的真正好处是什么?

git - git 子模块的不同推/pull url

git - 如何获取主分支中最新提交的修订号

Git Azure 部署缺少内容目录中的文件(MVC4 项目)

git - git 中 diff 分支相对于共同祖先的变化

git - 为什么 Git 忽略 .vs 目录?