Git 最后一次提交在哪里<;SHA-1>;子树回购的数据存储在本地

Git 最后一次提交在哪里<;SHA-1>;子树回购的数据存储在本地,git,git-subtree,Git,Git Subtree,他们说 git子树在元数据中存储子项目提交ID而不是引用 这意味着命令 git subtree add --prefix some-split-sub-directory https://some-other-repo-url master --squash 将主磁头的SHA-1存储在https://some-other-repo-urlgit管理的元数据信息中的某个地方 现在,当我下次运行以下命令时 git subtree pull --prefix some-split-sub-direc

他们说

git子树在元数据中存储子项目提交ID而不是引用

这意味着命令

git subtree add --prefix some-split-sub-directory https://some-other-repo-url master --squash
将主磁头的SHA-1存储在
https://some-other-repo-url
git管理的元数据信息中的某个地方

现在,当我下次运行以下命令时

git subtree pull --prefix some-split-sub-directory https://some-other-repo-url master --squash
git知道URL上最后一次提交的SHA-1
https://some-other-repo-url
它在根/父项目上被合并,现在它在最后一次提交SHA-1之后获取/合并代码/提交

现在我的问题是,上次提交子树的信息存储在本地
.git
文件夹中的什么位置

我怎么能认为这是存储的最后一次提交SHA-1,并且在下一次拉/合并之前/之后会发生


我查看了以下位置,如.git/config、.git/refs,但没有找到任何信息。

我在.git文件夹中也找不到它,但我设法使用以下函数获取它:

AFAICT it解析git历史以获取最新的相关子树压缩:

find_latest_squash () {
    debug "Looking for latest squash ($dir)..."
    dir="$1"
    sq=
    main=
    sub=
    git log --grep="^git-subtree-dir: $dir/*\$" \
        --no-show-signature --pretty=format:'START %H%n%s%n%n%b%nEND%n' HEAD |
    while read a b junk
    do
        debug "$a $b $junk"
        debug "{{$sq/$main/$sub}}"
        case "$a" in
        START)
            sq="$b"
            ;;
        git-subtree-mainline:)
            main="$b"
            ;;
        git-subtree-split:)
            sub="$(git rev-parse "$b^0")" ||
            die "could not rev-parse split hash $b from commit $sq"
            ;;
        END)
            if test -n "$sub"
            then
                if test -n "$main"
                then
                    # a rejoin commit?
                    # Pretend its sub was a squash.
                    sq="$sub"
                fi
                debug "Squash found: $sq $sub"
                echo "$sq" "$sub"
                break
            fi
            sq=
            main=
            sub=
            ;;
        esac
    done
}