Asked  7 Months ago    Answers:  5   Viewed   32 times

We're using git submodules to manage a couple of large projects that have dependencies on many other libraries we've developed. Each library is a separate repo brought into the dependent project as a submodule. During development, we often want to just go grab the latest version of every dependent submodule.

Does git have a built in command to do this? If not, how about a Windows batch file or similar that can do it?



If it's the first time you check-out a repo you need to use --init first:

git submodule update --init --recursive

For git 1.8.2 or above, the option --remote was added to support updating to latest tips of remote branches:

git submodule update --recursive --remote

This has the added benefit of respecting any "non default" branches specified in the .gitmodules or .git/config files (if you happen to have any, default is origin/master, in which case some of the other answers here would work as well).

For git 1.7.3 or above you can use (but the below gotchas around what update does still apply):

git submodule update --recursive


git pull --recurse-submodules

if you want to pull your submodules to latest commits instead of the current commit the repo points to.

See git-submodule(1) for details

Tuesday, June 1, 2021
answered 7 Months ago

The copy button is now a reality (May 2021), as tweeted by Nat Friedman

We just added a "Copy" button to all code blocks on GitHub.


Saturday, September 11, 2021
answered 3 Months ago

Original answer (January 2013)

You can follow the standard installation, and indicate in your gitlab.yml config file the location of your gitolite repo, as well as the gitolite admin user.

However, GitLab requires from the user to register themselves in GitLab and copy their public ssh key.
That means you might need to adapt the way gitolite has stored existing gitolite users, since the name you have used is likely to be different than the name used by GitLab (it uses a name based on the login_email_auuid).

Update (August 2018, 5 years later):

As commented below by Thomas, a few months after this answer, GitLab released GitLab 5.0, without gitolite.

Now I would like to add GitLab to be able to do code reviews and bug tracking.
What's the most convenient way to achieve this?

These days (2018, GitLab 11.2.x), code review is supported through merge request (it has been so since a few years already).

  • "Demo: Mastering code review with GitLab" from Emily von Hoffmann,
  • "Code Review Via GitLab Merge Requests" from Maxim Letushov.
Saturday, September 11, 2021
answered 3 Months ago

You appear to be using submodules in your repository. Run git submodule status to see the submodules in use.

"Problem 1", your confusion around commits, is due to the difference between committing changes to the root repository vs to a submodule's repository. It sounds like you are committing to a submodule repository and then updating the root repository to point its submodule at that new commit. This may be problematic if you are not publishing those commits because no one else will be able to find them should then checkout the root repository and want to fetch the submodules it depends on.

Github correctly does not show the contents of those directories because they are references to specific commits in other repositories, not part of the root repository itself.

While you could check all of these files into your root repository that does sound dangerous. by doing so you destroy information about where the contents of those subfolders came from. No one else (including you in the future) will be able to easily identify where that content came from or which revision you grabbed from those repositories.

Monday, October 4, 2021
answered 2 Months ago

You could try aliasing it.

git config "push --recurse-submodules=check"

Then use

git ps
Friday, October 8, 2021
Ramy Al Zuhouri
answered 2 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :