如果我在我的一个存储库中执行此操作:
git subtree pull --prefix=frameworks/AquaticPrime --squash AquaticPrime
Run Code Online (Sandbox Code Playgroud)
我明白了:
Working tree has modifications. Cannot add.
Run Code Online (Sandbox Code Playgroud)
如果我这样做(当然是在同一个地方):
git status
Run Code Online (Sandbox Code Playgroud)
我明白了:
# On branch master
nothing to commit (working directory clean)
Run Code Online (Sandbox Code Playgroud)
我不太确定这里发生了什么.git status命令意味着我没有修改,所以我假设git子树拉引用了与子树相关的不同分支中的修改,但它并不完全清楚.
任何人都可以提供启发吗?
我正在使用Git的子树命令将几个库拉入项目中.
如果我然后以正常方式克隆项目,我最终得到了我需要的所有代码,但是我丢失了子树关系 - 在克隆中,每个库都没有远程,并且没有-push分支的任何一方.
重建这种连接的最佳方法是什么?
这样做是否足够
git remote add <lib> <remote-url>
git fetch <lib>
Run Code Online (Sandbox Code Playgroud)
如果我是第一次添加该库,我将遵循以下内容:
git subtree add -P <local/lib> --squash "<lib>/master"
Run Code Online (Sandbox Code Playgroud)
当本地目录已经存在时,这不起作用,当然,当您克隆已经添加了库的项目时,它将会发生.
在这种情况下还有什么应该做的,以确保后续的git子树合并和git子树分割命令到预期的东西?