Hello,
I tried the "subtree push" and now the merge commit did not get pushed.
I'm sure it was when I still had my old subtree repo before rebuilding.
So probably the reason why git went crazy was because the initial
subtree repo was created based on one of my projects repositories by
filtering the commits down to just the files I wanted to extract.
So probably some internal references matched when pushing. I recreated
this subtree repo from scratch now and imported all relevant commits
using "git am". I hope this guarantees that I don't get unwanted
references from the source repository.
What will happen if I get a pull request which covers both, project
files and subtree files and then "subtree push" the changes? Will this
cause the merge commit to get pushed to my subtree repo?
Thanks
Manuel
On 27.05.22 16:54, Manuel Reimer wrote:
Hello,
maybe it's a bug in later GIT versions (2.36.1 here) but I kind of struggle to get git-subtree to work properly.
I even recreated the repo, I use for the subtree, from scratch to get sure there are no backreferences to the repo I've added the subtree to.
This is the repo, I want to have as "subtree" in other repos:
https://github.com/M-Reimer/webext-utils
I now pulled this into two projects as subtree using the command
https://github.com/M-Reimer/undoclosetab
https://github.com/M-Reimer/savescreenshot
For both projects I used the command:
git subtree add --prefix utils git@xxxxxxxxxx:M-Reimer/webext-utils.git master
In the first project (undoclosetab) I then added a new commit ("Add managed preference support") and pushed this back to the "subtree repo" using:
git subtree push --prefix utils git@xxxxxxxxxx:M-Reimer/webext-utils.git master
If I now try to pull this into my second project (savescreenshot), then git creates a merge commit for no reason.
git subtree pull --prefix utils "git@xxxxxxxxxx:M-Reimer/webext-utils.git" master
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (2/2), done.
Unpacking objects: 100% (3/3), 1.94 KiB | 497.00 KiB/s, done.
remote: Total 3 (delta 1), reused 3 (delta 1), pack-reused 0
From github.com:M-Reimer/webext-utils
* branch master -> FETCH_HEAD
Merge made by the 'ort' strategy.
utils/storage.js | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 56 insertions(+), 1 deletion(-)
Why does this happen? As soon as I have this merge commit a following "subtree push" also pushes this merge commit to the subtree repo and also pushes tags that are not relevant there.
I'm out of ideas now.
What I want to do: I want to be able to develop on modules, I have in the "subtree repo" in every project I want and then push the changes to the subtree repo for pulling into the other projects. That's why I don't want to use "squash" as I don't want to do development only in the subtree repo directly.
Thanks for any hints.
Manuel