git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Lehmann <Jens.Lehmann@web.de>
To: Howard Miller <howard@e-learndesign.co.uk>
Cc: git@vger.kernel.org
Subject: Re: Submodule confusion when checking out branch
Date: Tue, 11 Oct 2011 19:35:04 +0200	[thread overview]
Message-ID: <4E947E48.7080201@web.de> (raw)
In-Reply-To: <CAHVO_90rHbqqUx6HCh7tLWO9aP9PyPMpYnZGszCDB2bfNzUXAQ@mail.gmail.com>

Am 11.10.2011 11:38, schrieb Howard Miller:
> I added a submodule to my project like this (all from the root of the project)
> 
> git submodule add git@.....   path/to/submodule
> git submodule init
> git add path/to/submodule
> git commit -m 'I added a submodule!'
> git push
> 
> All looks good and 'git status' reports 'nothing to commit'
> 
> However, I now cannot change branches. On checkout, I get...
> 
> "error: The following untracked working tree files would be
> overwritten by checkout:"
> (followed by a big list of all the files in the submodule)
> 
> Where did I go wrong and what can I do to sort it?

Hmm, as I don't know for what checkout you see this problem (do you
switch from a branch containing the submodule to one that doesn't
have it or the other way round?) and assuming you had some files
committed in the directory where the submodule lives I can take a
guess what happened:

Could it be the case that you converted an existing directory into a
submodule and then get this error when you want to switch back to a
branch where this directory is still filled with the original files?

Then this is a known shortcoming of submodules at the moment. I have
experimental code to make Git work in that case but it is not ready
for inclusion yet.

      reply	other threads:[~2011-10-11 17:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-11  9:38 Submodule confusion when checking out branch Howard Miller
2011-10-11 17:35 ` Jens Lehmann [this message]

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=4E947E48.7080201@web.de \
    --to=jens.lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=howard@e-learndesign.co.uk \
    /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).