Where is git submodule update in SourceTree?
Solution 1
I couldn't find the answer myself, so I created a custom action. Go to Preferences, Custom Actions, and enter the following info: (This is on a Mac. Your path to the git executable may vary.)
Solution 2
Just double-click on the submodule or left-click and open the module
Once in the submodule, the UI is like any git repo , press on pull/fetch to update to the header. And voila.
Solution 3
Here is the windows version:
This command assumes the location of your sh.exe
- depending on how you setup SourceTree it could be somewhere else.
/c %LOCALAPPDATA%\Atlassian\SourceTree\git_local\bin\sh.exe --login -i -c "git submodule update"""
Not sure whether it is a bug - but in the version of Sourcetree I am using (v1.6.14.0) I found that having the extra pair of quotations ""
on the end was required - otherwise an extra quotation exists and the unbalanced statement then causes sh
to bark:
cmd "/c %LOCALAPPDATA%\Atlassian\SourceTree\git_local\bin\sh.exe --login -i -c "git submodule update""
sh: unexpected EOF while looking for matching `"'
sh: syntax error: unexpected end of file
Completed with errors, see above.
Solution 4
I'm using source tree v3.4.6, you can enable it via menu Tools\Options
When clone, you should enable Recurse submodules
Solution 5
The link provided by Isuru does include how to perform update (look for "Change the submodule commit which your repository is tracking")
In short, on the main repository,
- choose the submodules dropdown
- double click the submodule you want to update - you will switch focus to the submodule
- pull (latest) or checkout (specific commit) the required update
- go back to the tab for the main repository
- there will be an uncommitted change (which submodule commit to use) in the main repository
- commit and push the change
wnrph
Interested in natural siences, networking, linux, computer engineering, c++ and the web
Updated on October 14, 2021Comments
-
wnrph over 2 years
How can I update git sub modules in SourceTree?
-
wnrph over 11 yearsAre you sure this does what
git submodule update
does? At any event, I don't like togit fetch
orgit pull
(because these would disregard the revision indicated by the containing repository.) -
Raymond Chenon over 11 yearsgood question !! Coming from subversion , I did not know the difference between "fetch" and "update". Take a look answers.atlassian.com/questions/33274/…
-
ctpenrose about 10 yearsyou also may want to use "submodule update --init --recursive". It is harmless to add "--init" if an initialization has already been done, and it may be necessary if you freshly cloned a repo with submodules. "--recursive" is harmless if you don't have submodules which reference other submodules, and essential if you do.
-
Ambidex almost 10 yearsThis will checkout the latest version if you ask me, not checkout the commit which is committed in the main repo.
-
GolezTrol about 8 yearsDoesn't seem to work, but that's maybe because SourceTree adds an extra pair of quotes around the whole parameter string.
-
GolezTrol about 8 yearsThis is exactly what I was looking for, and it's also described in the documentation. "If there are new changes in the submodule which you want to use in your repository, all you have to do is open the submodule (double-click) and checkout/update to a different commit, either via pull, merge or just manually checking a commit out ... Once you have done this, return to the parent repository and you will see an uncommitted change on the submodule, which will show in the diff the change in tracked commit:"
-
Raja over 6 yearsThe goal of
git submodule update
is to switch to the version specified in the parent repo. (That is good for consumers who just want to use the recommended submodule.) Pulling on the other hand will bring the latest version from the upstream repository. (This is better if you want to work on the submodule, or if you want to use the latest version regardless of which version the parent repo specifies.) -
Adi over 6 yearsbasically this is what you need
-
Tj3n almost 2 yearsOnly for cloning... not pulling