在我的当前项目中,我正在使用一个开源论坛(https://github.com/vanillaforums/Garden)。我计划像这样做:
git remote add vanilla_remote https://github.com/vanillaforums/Garden.git
git checkout -b vanilla vanilla_remote/master
git checkout master
git read-tree --prefix=vanilla -u vanilla
这样,我可以对vanilla文件夹进行更改(比如更改配置),并将其提交到我的主分支。我还可以切换到我的vanilla分支以获取更新。但当我尝试合并这两个分支时遇到了问题。
git checkout vanilla
git pull
git checkout master
git merge --squash -s subtree --no-commit vanilla
git commit -a -m "update commit"
问题在于“更新提交”覆盖了我的提交并“覆盖”了我的更改。我更喜欢我的提交在更新之上重放。有没有简单的方法可以做到这一点?我不太擅长 git,所以也许这是错误的方法。此外,我真的不想将我的历史记录与原始历史记录混在一起。