From: Manuel Reimer <mail+git@m-reimer.de>
To: git@vger.kernel.org
Subject: How to properly use git-subtree (and prevent it from adding merge commits)?
Date: Fri, 27 May 2022 16:54:25 +0200 [thread overview]
Message-ID: <3DEED6A1-6344-472C-9E03-39ADF3076B2D@m-reimer.de> (raw)
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@github.com: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@github.com: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@github.com: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
next reply other threads:[~2022-05-27 14:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-27 14:54 Manuel Reimer [this message]
2022-05-27 17:55 ` How to properly use git-subtree (and prevent it from adding merge commits)? Manuel Reimer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3DEED6A1-6344-472C-9E03-39ADF3076B2D@m-reimer.de \
--to=mail+git@m-reimer.de \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).