Recursive submodule checkout on every branch switch

Ben Saunders September 5, 2013

Is it possible to make SourceTree not do a recursive submodule checkout when switching between branches? Even though the original checkout was done without submodule recursion, a branch switch always does this:

git -c diff.mnemonicprefix=false -c core.quotepath=false submodule update --init --recursive

16 answers

1 vote
Cyber X June 9, 2017

+1

There is an issue for this case, please vote!

https://jira.atlassian.com/browse/SRCTREEWIN-7427

1 vote
Christian Ludwig June 8, 2017

We are having a project where the number of submodules increased to +50. Because of the lack of this option we stopped using SourceTree because you can guess that switching a branch was a real PITA.

An other point for this option is that not every developer has access to every submodule, so he gets an error message on every pull and checkout what causes in addition a parent repository with damaged submodules.

IMHO the idea of submodules is that you can decide yourself to clone it or not. If I only want to make a small change within the 100 kb big parent repository I do not want to clone 2 gb of submodules.

Looking forward to see this option back again in SourceTree.

Alexander Pakizh June 8, 2017

My colleagues are proposing to use smartGit or GitKraken that haven't problem with submodules when they switch brunches. What GUI for git are you using now?

Christian Ludwig June 9, 2017

Commandline and gitk

HuXiang June 10, 2017

I have tried the gitk , but it also sync the submodules everytime I chechout the branch. so how to config it ?

Alexander Pakizh June 10, 2017

I've created bug report about this problem. You can vote it here

https://jira.atlassian.com/browse/SRCTREEWIN-7427

1 vote
Alexander Pakizh June 8, 2017

But there is this option? Why did you remove it??

https://blog.sourcetreeapp.com/page/4/

  • New repository option to disable recursive submodule operations
1 vote
Alexander Pakizh June 8, 2017

I've used SourceTree for some monthes, but without this feature I should select other GUI program for git. Thanks

1 vote
HuXiang May 19, 2017

Yet another year and no fix? This basically almost stops me from using SourceTree

1 vote
Ian Jimenez March 8, 2016

We have a similar interest and have not seen any good solutions.

1 vote
netheril96 September 21, 2014

Actually I find the answer accidentally.

On the right upper side there is a button `Settings` which is different for each repo.  Under the `Advanced Tab` there is the option.

Zdeněk Válek February 11, 2015

Which option? I did not find there anything useful. Maybe it disappeared in my version :-(

Christopher Courtois July 7, 2015

I don't see the option either, is there a new way to disable it ?

sturmi November 24, 2015

He's partialy right, it's the "Automatically refresh(...)" checkbox. After unchecking this option, the submodules don't update recursively by doubleclicking them. But they still update recursively after swtiching an branch... kinda annoying

0 votes
Bela Babik July 26, 2017

I use a script as a workaround. Just select use system git and navigate to a script like this one:

#!/bin/bash
GITBIN=/usr/local/bin/git
if [[ $@ == *"submodule update --init --recursive" ]]; then
$GITBIN ${@:1:$(($# - 1))}
else
$GITBIN "$@"
fi

Karl Schulze February 8, 2019

How do you make this work in windows?

0 votes
Zdeněk Válek July 29, 2015

OK, it seems that there is no hope for restoring the option. Probably most people are not having my problems and I can live with different GUI and command-line tools. Thank you for your time.

0 votes
Mart July 29, 2015

Yet another year and no fix? This basically stops our whole company from using SourceTree

0 votes
Mike Friedrich
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 28, 2015

to a) i do not see this as a problem. This is just as any other developers bug, like forgetting to add a new file to git. This should (imo) not be fixed by "special" submodule checkouts. to b) I don't see this as a problem. Checking out submodules detached is the standard behaviour of git submodule update.

0 votes
Zdeněk Válek July 28, 2015

I see two problems with submodules: a) if some team members are not using them properly (i.e. not commiting the submodule hashes in main repo) then every checkout in main repo is a pain, b) It is checking out comits (not branches) on submodules, so each checkout on main repo detaches other repos. The option to disable this feature would be fine.

0 votes
Ben Saunders July 23, 2015

--recursive can be an issue if you've set up your submodules in a way where you want more control over how they get initialized. Such as, if any of your submodules of your application also have your framework as a submodule, recursive will check out N number of that framework. One of the downsides to submodules, really, but the frustrating thing was how Sourcetree didn't have an option to disable it. Although, as you can see below it now is an option under `Settings`.

0 votes
Mike Friedrich
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 23, 2015

What is the problem with --recursive? In our project we need recursive updates because have nested submodules.

0 votes
netheril96 September 21, 2014

A year has passed and this still hasn't been fixed? It makes sourcetree unusable for me.

0 votes
Anders Wang Kristensen August 30, 2014

Same issue when double-clicking a submodule. Please provide a way to disable the --recurve option.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events