When you add a subrepo using git subtree add --prefix third_party/libfoo upstream_libfoo master --squash it will:
- Create a new root commit containing the contents
masterfrom thelibfoorepo. - Create a merge commit with
HEADand that new root commit as parents. In this merge commit all of the files from the root commit are moved from/...to/third_party/libfoo/....
The fact that the files are moved during the merge commit creates some issues:
- You can't rebase the root commit & merge. Even with
--rebase-mergesGit will get confused because it tries to create a normal merge, not a merge that also moves files. - You can't easily diff between
masterand the root commit (or a later squashed commit). It kind of works, but the fact that all the files have moved confuses things massively. Especially if you've also added/removed files.
Is there any way to make git subtree store the files in its squashed commits at the same path that they will be merged into? It seems like such an obvious thing to do.