# Changled submodule cannot be "git added"

3 messages from 2010-06-15 to 2010-06-15. Participants: Nico -telmich- Schottelius, Jens Lehmann.
Thread: https://gitlist.dev/t/24118

## Nico -telmich- Schottelius, 2010-06-15 07:25

Subject: Changled submodule cannot be "git added"
Message-ID: <20100615072514.GA3260@schottelius.org>
URL: https://gitlist.dev/e/20100615072514.GA3260%40schottelius.org

```
And another interesting behaviour of git with submodules:

--------------------------------------------------------------------------------
% git status
# On branch master
# Your branch is ahead of 'origin/master' by 8 commits.
#
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#   (commit or discard the untracked or modified content in submodules)
#
#       modified:   modules/tftpd_hpa (modified content)
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       modules/ethz_systems_private/
no changes added to commit (use "git add" and/or "git commit -a")
% git add modules/tftpd_hpa
# On branch master
# Your branch is ahead of 'origin/master' by 8 commits.
#
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#   (commit or discard the untracked or modified content in submodules)
#
#       modified:   modules/tftpd_hpa (modified content)
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       modules/ethz_systems_private/
no changes added to commit (use "git add" and/or "git commit -a")
--------------------------------------------------------------------------------

- Why can modules/tftpd_hpa not be added?
- Why does git checkout not remove modules/ethz_systems_private/,
  when switching from the master to the private branch?
  (the module is only registered in the private branch)

Nico

-- 
New PGP key: 7ED9 F7D3 6B10 81D7 0EC5  5C09 D7DC C8E4 3187 7DF0
Please resign, if you signed 9885188C or 8D0E27A4.

Currently moving *.schottelius.org to http://www.nico.schottelius.org/ ...

```

## Nico -telmich- Schottelius, 2010-06-15 07:37

Subject: Re: Changled submodule cannot be "git added"
Message-ID: <20100615073720.GB3260@schottelius.org>
URL: https://gitlist.dev/e/20100615073720.GB3260%40schottelius.org
In-Reply-To: <20100615072514.GA3260@schottelius.org>

```
Nico -telmich- Schottelius [Tue, Jun 15, 2010 at 09:25:14AM +0200]:
> And another interesting behaviour of git with submodules:
> 
> --------------------------------------------------------------------------------
> % git status
> #       modified:   modules/tftpd_hpa (modified content)

Ok, found out that I changed stuff within modules/tftpd_hpa, instead of
merging from the source.

Imho the git status output is a bit misleading, as I assume that
I can git add stuff that's modified.

Perhaps git add should print a warning / error if I try to add the
changed submodule and not silently ignore it.

Regarding the other problem

> - Why does git checkout not remove modules/ethz_systems_private/,
>   when switching from the master to the private branch?
>   (the module is only registered in the private branch)

I'm still not sure what's the reason for that.

Nico

-- 
New PGP key: 7ED9 F7D3 6B10 81D7 0EC5  5C09 D7DC C8E4 3187 7DF0
Please resign, if you signed 9885188C or 8D0E27A4.

Currently moving *.schottelius.org to http://www.nico.schottelius.org/ ...

```

## Jens Lehmann, 2010-06-15 16:05

Subject: Re: Changled submodule cannot be "git added"
Message-ID: <4C17A4D5.5040100@web.de>
URL: https://gitlist.dev/e/4C17A4D5.5040100%40web.de
In-Reply-To: <20100615073720.GB3260@schottelius.org>

```
Am 15.06.2010 09:37, schrieb Nico -telmich- Schottelius:
> Nico -telmich- Schottelius [Tue, Jun 15, 2010 at 09:25:14AM +0200]:
>> % git status
>> #       modified:   modules/tftpd_hpa (modified content)
> 
> Ok, found out that I changed stuff within modules/tftpd_hpa, instead of
> merging from the source.

To make such surprises visible is the intent of showing "(modified
content)" here.


> Imho the git status output is a bit misleading, as I assume that
> I can git add stuff that's modified.

Maybe you just overlooked this line in the output of "git status":
"(commit or discard the untracked or modified content in submodules)"


> Regarding the other problem
> 
>> - Why does git checkout not remove modules/ethz_systems_private/,
>>   when switching from the master to the private branch?
>>   (the module is only registered in the private branch)
> 
> I'm still not sure what's the reason for that.

Because there might be stuff in there which is not tracked but you
might hate loosing by switching a branch.

```
