如何获得git子树差异?

gre*_*egw 11 git git-diff git-subtree

我有一个已安装另一个存储库的存储库

git subtree add -P some/path  otherremote otherbranch
Run Code Online (Sandbox Code Playgroud)

开发已经发生了一些局部变化,但也进行了几轮合并:

git fetch otherremote
git subtree merge -P some/path otherremote/otherbranch
git commit
Run Code Online (Sandbox Code Playgroud)

现在我想在otherremote/otherbranch的HEAD和某些/ path的树之间获得差异.我怎样才能做到这一点?

Hob*_*lay 8

这应该是你正在寻找的:

git diff otherremote/otherbranch commit:some/path

您甚至可以使用所有标准commit命名约定来比较以前的修订版.

例如,我已经制作了一个远程仓库u-boot,master分支,我主要仓库的子树u-boot/.要查看我在本地主分支中所做的更改,因为远程仓库中的特定版本:

git diff u-boot/master~17 master:u-boot/

使用git 1.9.0测试,虽然我很确定这通常适用于旧版本.