From: Junio C Hamano <gitster@pobox.com>
To: Nicolas Morey-Chaisemartin <devel-git@morey-chaisemartin.com>
Cc: Jens Lehmann <Jens.Lehmann@web.de>, git@vger.kernel.org
Subject: Re: [PATCH] submodule: Add --force option for git submodule update
Date: Wed, 30 Mar 2011 14:08:45 -0700 [thread overview]
Message-ID: <7vd3l8mi3m.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <4D93905E.5030806@morey-chaisemartin.com> (Nicolas Morey-Chaisemartin's message of "Wed, 30 Mar 2011 22:19:42 +0200")
Nicolas Morey-Chaisemartin <devel-git@morey-chaisemartin.com> writes:
> On 03/30/2011 09:05 PM, Jens Lehmann wrote:
>>> I know it is very intrusive. The main reason for that is I wanted the -f option to always behave the same (meaning throw away changes),
>>> whether the submodule is already on the right commit or not.
>>
>> Hmm, I don't know if that is a good thing to do. People are used to
>> "git submodule update" to only touch those submodule where the HEAD
>> differs from the commit recorded in the superproject (And I often
>> find myself using "-f" if the command didn't succeed without it).
>> But when using "-f" touches other submodules than not using it the
>> user might experience a rather unpleasant surprise, I'm not sure we
>> want to go that way.
>
> Well I was'nt sure about it either.
> The idea for me was to be able to put the repo and submodules in the cloned state (except for ignored files)
> In the current version the right thing to do is a bit of a mess:
> $ git submodule foreach --recursive 'git checkout -f HEAD'
> $ git submodule foreach --recursive 'git clean -f' # An untracked file on HEAD may be overwrittent by the new HEAD so checkout may fail if you don't do that
> $ git submodule update --recursive
Shouldn't you be questioning _why_ your users have such changes that
require them to run "checkout -f" everywhere in the submodule forests and
still want to run "submodule update" in the first place? If it happens
very often and your users are constantly discarding what they have half
accomplished, there is something wrong with the way your project works.
If we read your motivation section in your original,
> This implies that to reset a whole git submodule tree, a user has to run
> first 'git submodule foreach --recursive git checkout -f' to then be
> able to run git submodule update.
this is about "resetting", i.e. throwing away the work. I think that is a
sensible thing to do, but it is a very different purpose than "updating
submodules so that I can work on top of what other people did", which
would happen a lot more often than that.
Wouldn't it be both safer and easier to understand for the users if this
"obliterate all my uncommitted work" were a separate subcommand, e.g. "git
submodule reset --recursive" or something?
next prev parent reply other threads:[~2011-03-30 21:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-30 7:56 [PATCH] submodule: Add --force option for git submodule update Nicolas Morey-Chaisemartin
2011-03-30 18:32 ` Jens Lehmann
2011-03-30 18:50 ` Nicolas Morey-Chaisemartin
2011-03-30 19:05 ` Jens Lehmann
2011-03-30 20:19 ` Nicolas Morey-Chaisemartin
2011-03-30 21:08 ` Junio C Hamano [this message]
2011-03-31 2:20 ` Nicolas Morey-Chaisemartin
2011-03-31 17:41 ` Jens Lehmann
2011-03-31 18:13 ` Nicolas Morey-Chaisemartin
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=7vd3l8mi3m.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=Jens.Lehmann@web.de \
--cc=devel-git@morey-chaisemartin.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 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 NNTP newsgroup(s).