Where is git submodule update in SourceTree?

38,890

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.) git submodule update custom action

Solution 2

Just double-click on the submodule or left-click and open the module enter image description here

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 version:

enter image description here

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 enter image description here

When clone, you should enable Recurse submodules enter image description here

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
Share:
38,890
wnrph
Author by

wnrph

Interested in natural siences, networking, linux, computer engineering, c++ and the web

Updated on October 14, 2021

Comments

  • wnrph
    wnrph over 2 years

    How can I update git sub modules in SourceTree?

  • wnrph
    wnrph over 11 years
    Are you sure this does what git submodule update does? At any event, I don't like to git fetch or git pull (because these would disregard the revision indicated by the containing repository.)
  • Raymond Chenon
    Raymond Chenon over 11 years
    good question !! Coming from subversion , I did not know the difference between "fetch" and "update". Take a look answers.atlassian.com/questions/33274/…
  • ctpenrose
    ctpenrose about 10 years
    you 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
    Ambidex almost 10 years
    This will checkout the latest version if you ask me, not checkout the commit which is committed in the main repo.
  • GolezTrol
    GolezTrol about 8 years
    Doesn't seem to work, but that's maybe because SourceTree adds an extra pair of quotes around the whole parameter string.
  • GolezTrol
    GolezTrol about 8 years
    This 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
    Raja over 6 years
    The 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
    Adi over 6 years
    basically this is what you need
  • Tj3n
    Tj3n almost 2 years
    Only for cloning... not pulling