Questions tagged «subtree»

2
将上游项目推到master上后,如何修复git子树?
我一直在尝试使用git子树,并遇到了以下情况。 我使用git子树将一个外部项目添加到我的仓库中,我有意保留了上游项目的所有历史记录,因为我希望能够参考该项目的历史记录,并在以后为上游项目做出贡献。 事实证明,上游项目的另一个贡献者不小心将一个大文件推入了master分支。为了解决这个问题,上游项目改写了历史并将其推向了主人。在创建“ monorepo”时,我包括了该提交,并且我也想删除它。 如何更新存储库以反映子树的新历史记录? 我的第一个尝试是使用filter-branch完全删除子树和所有历史记录。 git filter-branch --index-filter 'git rm -rf --cached --ignore-unmatch upstream-project-dir' --prune-empty HEAD 一旦删除了旧版本的子树,我就可以使用新的上游母版重新添加子树。但是,这不起作用,因为由于某种原因,提交历史记录仍显示在git日志输出中。 更新资料 我已经写好了创建最小可复制示例的步骤。 首先创建一个空的git repo。 git init test-monorepo cd ./test-monorepo 创建一个初始提交。 echo hello world > README git add README git commit -m 'initial commit' 现在为外部项目添加一个子树。 git remote add thirdparty git@github.com:teivah/algodeck.git git fetch thirdparty …
13 git  subtree 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.