我有两个存储库。有时,我想将的内容合并other到main. 但是,合并会忽略已删除的文件。让我通过一个例子来解释它:
mkdir -p test/main test/other
cd test/other/
git init
touch one two three
git add .
git commit -m "Add one, two and three."
cd ../main/
git init
touch four
git add .
git commit -m "Add four."
添加other到main远程。
git remote add other ../other/
git fetch other
合并其内容。
git merge --squash other/master
git commit -m "Merge other."
它正确地添加了文件。现在,删除other.
cd ../other/
git rm two
git commit -m "Remove two."
合并更改为main.
cd ../main/
git fetch other
git merge --squash other/master
合并后git status说:
# On branch master
nothing to commit (working directory clean)
我希望合并删除two,因为它在other. 我究竟做错了什么?