All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Limbouris <james@digitalmatter.com>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Submodule update setting not respected by git pull
Date: Thu, 3 Jun 2021 06:33:21 +0000	[thread overview]
Message-ID: <SL2PR03MB39644447B726A8C024259AA2A43C9@SL2PR03MB3964.apcprd03.prod.outlook.com> (raw)

Hi Git community,

I've been wanting to use the git submodules feature for many years, but have always been put off by the ease with which you could lose work in the past. Much progress has now been made, and with the '[submodule] recurse = true' setting and the 'update = merge' setting, it's starting to look much safer.

The only remaining sharp edge seems to be the 'git pull' command. It doesn't seem to respect the 'update = merge' setting, and will overwrite a submodule version in your working copy with the submodule version from your remote, instead of merging or rebasing. I'm not sure if this is by design, or it's a bug? But it seems like a bug, since 'git pull' is respectful of uncommitted changes in the submodule, and also won't overwrite the submodule version if it has been staged in the containing project.

Git version: 2.31.1.windows.1
Steps to reproduce:

1. Add a submodule to your project, with the 'update = merge' setting, and default recursion to on:

[submodule "modules/mylibrary"]
	active = true
	url = <. . .>
	update = merge
[submodule]
	recurse = true

2. Cd into the submodule, checkout master, and add a new commit
3. Cd back into the enclosing project
4. 'git submodule update --init --recursive --remote' will correctly leave your submodule pointing at the new commit
5. 'git pull --rebase' will correctly leave your submodule pointing at the new commit
6. But 'git pull' will replace your submodule with a detached head, ignoring the 'update = merge' setting

This will then lead to lost work when you fail to notice, and commit the reverted submodule version in the enclosing project.

Am I wrong to want 'git pull' to use the 'update = merge' setting - is this a feature?

Regards,
James Limbouris


                 reply	other threads:[~2021-06-03  6:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SL2PR03MB39644447B726A8C024259AA2A43C9@SL2PR03MB3964.apcprd03.prod.outlook.com \
    --to=james@digitalmatter.com \
    --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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.