# Force git submodule update --remote for some branches

2 messages from 2014-11-28 to 2014-11-30. Participants: Timothy M. Redaelli, Jens Lehmann.
Thread: https://gitlist.dev/t/38069

## Timothy M. Redaelli, 2014-11-28 17:54

Subject: Force git submodule update --remote for some branches
Message-ID: <5478B6F1.6070200@gmail.com>
URL: https://gitlist.dev/e/5478B6F1.6070200%40gmail.com

```
Hi,
I have a repository with a submodule and I'd like to force git to
checkout the LAST version of the submodule and not the stored one (like
git submodule update --remote), but only on some branches and without
the need to remember to add --remote every time you are on this branch.

Is there any way to do it? Maybe using .gitmodules?

Thanks

-- 
Timothy M. Redaelli
Arch Linux Trusted User


```

## Jens Lehmann, 2014-11-30 14:52

Subject: Re: Force git submodule update --remote for some branches
Message-ID: <547B2F30.8090003@web.de>
URL: https://gitlist.dev/e/547B2F30.8090003%40web.de
In-Reply-To: <5478B6F1.6070200@gmail.com>

```
Am 28.11.2014 um 18:54 schrieb Timothy M. Redaelli:
> I have a repository with a submodule and I'd like to force git to
> checkout the LAST version of the submodule and not the stored one (like
> git submodule update --remote), but only on some branches and without
> the need to remember to add --remote every time you are on this branch.
>
> Is there any way to do it? Maybe using .gitmodules?

Not yet.

But yes, .gitmodules would be the right place to put such a
configuration as then it would be per submodule and also per
(superproject-)branch.

By the way, what do you think the output of git status and
git diff should look like when you updated a submodule to
its branch tip which differs from the commit recorded in
the superproject? Should these changes be displayed or not?
And only if the new tip is a fast-forward of the old or
always?

```
