Use of the 'git submodule update --remote' command for repositories that track the branch tip of submodules

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Use of the 'git submodule update --remote' command for repositories that track the branch tip of submodules

SmartGit mailing list
Hello,
 

 I am evaluating SmartGit for use at the company I work for, and have a question regarding interacting with submodules using SmartGit.
 

 Git v1.8.2, released in march 2013, introduced new functionality for submodules: "git submodule" started learning of a new mode to integrate with the tip of the remote branch (as opposed to integrating with the commit recorded in the superproject's gitlink). [link https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.2.txt]
 

 Submodules that are configured to track a branch (as identified in the outer repository's .gitmodules file) can be updated to the tip of the remote branch instead of the commit recorded in the outer repository by using the command:
 

 git submodule update --remote
 

 

 Currently our company has a super-project repository containing dozens of submodules, the majority of which are setup to track branches.
 

 Eg: The master branch of super-project repository tracks the master branches of the submodules. The release-1.0 branch of the super-project tracks the release-1.0 branches of the relevant submodules, etc.
 

 Is there a way to configure SmartGit via the GUI or the smartgit.properties file to perform this "git submodule update --remote" command, either as part of the pull command on the outer repository, or as part of the branch checkout command of the outer repository, or as a separate command all together?
Reply | Threaded
Open this post in threaded view
|

Re: Use of the 'git submodule update --remote' command for repositories that track the branch [...]

SmartGit mailing list
>  Git v1.8.2, released in march 2013, introduced new functionality for submodules:
> "git submodule" started learning of a new mode to integrate with the tip of the
> remote branch (as opposed to integrating with the commit recorded in the
> superproject's gitlink). [link
> https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.2.txt]
>  
>
>  Submodules that are configured to track a branch (as identified in the outer
> repository's .gitmodules file) can be updated to the tip of the remote branch
> instead of the commit recorded in the outer repository by using the command:
>  
>
>  git submodule update --remote

The problem with this new feature is that it does not actually *track* a branch (as Subversion svn:externals does). After invoking update --remote, you may end up with a modified submodule (according to "git status"). This happens, because internally a submodule reference can only point to an SHA, but not a ref.

For this reason, we do not plan to support this feature for SmartGit, because it will result in modifications and most likely unwanted commits containing these submodule modifications. If there are many user working on a project and the submodules are developed quite actively, this will result in conflicts: one user changes the submodule SHA to x, the other to y.

Instead, I'd recommend to manually update submodules and if you actually have to do that too often, because submodule and super-repository are related to closely, consider to inline the submodule into the super-repository.

--
Best regards,
Marc Strapetz
syntevo GmbH
http://www.syntevo.com
http://blog.syntevo.com



12/08/2014 11:20 - [hidden email] [smartgit] wrote:

> Hello,
>  
>
>  I am evaluating SmartGit for use at the company I work for, and have a question
> regarding interacting with submodules using SmartGit.
>  
>
>  Git v1.8.2, released in march 2013, introduced new functionality for submodules:
> "git submodule" started learning of a new mode to integrate with the tip of the
> remote branch (as opposed to integrating with the commit recorded in the
> superproject's gitlink). [link
> https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.2.txt]
>  
>
>  Submodules that are configured to track a branch (as identified in the outer
> repository's .gitmodules file) can be updated to the tip of the remote branch
> instead of the commit recorded in the outer repository by using the command:
>  
>
>  git submodule update --remote
>  
>
>  
>
>  Currently our company has a super-project repository containing dozens of
> submodules, the majority of which are setup to track branches.
>  
>
>  Eg: The master branch of super-project repository tracks the master branches of
> the submodules. The release-1.0 branch of the super-project tracks the release-1.0
> branches of the relevant submodules, etc.
>  
>
>  Is there a way to configure SmartGit via the GUI or the smartgit.properties file
> to perform this "git submodule update --remote" command, either as part of the
> pull command on the outer repository, or as part of the branch checkout command of
> the outer repository, or as a separate command all together?
>