Skip to main content

With git you can use git submodule.

ProductA can have specific commit_ids (which can be a branch) of some submodules (for example ComponentA, ComponentB, SharedComponentC).

To add a component to ProductA, from the ProductA directory on your development machine do:

C:\projects\ProductA.git\> git submodule add --branch master --name ComponentA http://reposerver.ourcompany.com/ComponentA components/ComponentA
C:\projects\ProductA.git\> git submodule add --branch master --name ComponentB http://reposerver.ourcompany.com/ComponentB components/ComponentB
C:\projects\ProductA.git\> git submodule add --branch ProjectA --name sharedComponentC http://reposerver.ourcompany.com/ComponentC components/sharedComponentC

Other developers can use:

C:\projects\ProductA.git\> git submodule init
C:\projects\ProductA.git\> git submodule update

to receive the correct versions of the submodules in their working directory.

When you make some changes to a submodule, you commit the cangeschanges of the submodule and you commit the new version of the submodule in the project, i.e.:

C:\projects\ProductA.git\components\sharedComponentC\> git add ...
C:\projects\ProductA.git\components\sharedComponentC\> git commit
C:\projects\ProductA.git\components\sharedComponentC\> cd ..\..
C:\projects\ProductA.git\> git add components/sharedComponent
C:\projects\ProductA.git\> git commit

Remarks

  • I used commandlinecommand-line syntax to explain how to use git; you are free to use any graphical tool or visual studio plugin that you like.
  • I checked the syntax and parameters under linuxLinux and translated the examples to windowWindows command prompt, so there might some mistaksemistakes (e.g. slashedslashes instead of dashes); refer to the git reference manual for the exact syntax.
  • names ofThe project dirdirectory (C:\projects\ProductA.git), branch name (ComponentA), repository location (http://reposerver.ourcompany.com/ComponentA), and submodule directory (components/ComponentA) can vary independently.

With git you can use git submodule.

ProductA can have specific commit_ids (which can be a branch) of some submodules (for example ComponentA, ComponentB, SharedComponentC).

To add a component to ProductA, from the ProductA directory on your development machine do:

C:\projects\ProductA.git\> git submodule add --branch master --name ComponentA http://reposerver.ourcompany.com/ComponentA components/ComponentA
C:\projects\ProductA.git\> git submodule add --branch master --name ComponentB http://reposerver.ourcompany.com/ComponentB components/ComponentB
C:\projects\ProductA.git\> git submodule add --branch ProjectA --name sharedComponentC http://reposerver.ourcompany.com/ComponentC components/sharedComponentC

Other developers can use:

C:\projects\ProductA.git\> git submodule init
C:\projects\ProductA.git\> git submodule update

to receive the correct versions of the submodules in their working directory.

When you make some changes to a submodule, you commit the canges of the submodule and you commit the new version of the submodule in the project, i.e.:

C:\projects\ProductA.git\components\sharedComponentC\> git add ...
C:\projects\ProductA.git\components\sharedComponentC\> git commit
C:\projects\ProductA.git\components\sharedComponentC\> cd ..\..
C:\projects\ProductA.git\> git add components/sharedComponent
C:\projects\ProductA.git\> git commit

Remarks

  • I used commandline syntax to explain how to use git; you are free to use any graphical tool or visual studio plugin that you like.
  • I checked the syntax and parameters under linux and translated the examples to window command prompt, so there might some mistakse (e.g. slashed instead of dashes) refer to the git reference manual for the exact syntax.
  • names of project dir (C:\projects\ProductA.git), branch name (ComponentA), repository location (http://reposerver.ourcompany.com/ComponentA), and submodule directory (components/ComponentA) can vary independently.

With git you can use git submodule.

ProductA can have specific commit_ids (which can be a branch) of some submodules (for example ComponentA, ComponentB, SharedComponentC).

To add a component to ProductA, from the ProductA directory on your development machine do:

C:\projects\ProductA.git\> git submodule add --branch master --name ComponentA http://reposerver.ourcompany.com/ComponentA components/ComponentA
C:\projects\ProductA.git\> git submodule add --branch master --name ComponentB http://reposerver.ourcompany.com/ComponentB components/ComponentB
C:\projects\ProductA.git\> git submodule add --branch ProjectA --name sharedComponentC http://reposerver.ourcompany.com/ComponentC components/sharedComponentC

Other developers can use:

C:\projects\ProductA.git\> git submodule init
C:\projects\ProductA.git\> git submodule update

to receive the correct versions of the submodules in their working directory.

When you make some changes to a submodule, you commit the changes of the submodule and you commit the new version of the submodule in the project, i.e.:

C:\projects\ProductA.git\components\sharedComponentC\> git add ...
C:\projects\ProductA.git\components\sharedComponentC\> git commit
C:\projects\ProductA.git\components\sharedComponentC\> cd ..\..
C:\projects\ProductA.git\> git add components/sharedComponent
C:\projects\ProductA.git\> git commit

Remarks

  • I used command-line syntax to explain how to use git; you are free to use any graphical tool or visual studio plugin that you like.
  • I checked the syntax and parameters under Linux and translated the examples to Windows command prompt, so there might some mistakes (e.g. slashes instead of dashes); refer to the git reference manual for the exact syntax.
  • The project directory (C:\projects\ProductA.git), branch name (ComponentA), repository location (http://reposerver.ourcompany.com/ComponentA), and submodule directory (components/ComponentA) can vary independently.
Source Link

With git you can use git submodule.

ProductA can have specific commit_ids (which can be a branch) of some submodules (for example ComponentA, ComponentB, SharedComponentC).

To add a component to ProductA, from the ProductA directory on your development machine do:

C:\projects\ProductA.git\> git submodule add --branch master --name ComponentA http://reposerver.ourcompany.com/ComponentA components/ComponentA
C:\projects\ProductA.git\> git submodule add --branch master --name ComponentB http://reposerver.ourcompany.com/ComponentB components/ComponentB
C:\projects\ProductA.git\> git submodule add --branch ProjectA --name sharedComponentC http://reposerver.ourcompany.com/ComponentC components/sharedComponentC

Other developers can use:

C:\projects\ProductA.git\> git submodule init
C:\projects\ProductA.git\> git submodule update

to receive the correct versions of the submodules in their working directory.

When you make some changes to a submodule, you commit the canges of the submodule and you commit the new version of the submodule in the project, i.e.:

C:\projects\ProductA.git\components\sharedComponentC\> git add ...
C:\projects\ProductA.git\components\sharedComponentC\> git commit
C:\projects\ProductA.git\components\sharedComponentC\> cd ..\..
C:\projects\ProductA.git\> git add components/sharedComponent
C:\projects\ProductA.git\> git commit

Remarks

  • I used commandline syntax to explain how to use git; you are free to use any graphical tool or visual studio plugin that you like.
  • I checked the syntax and parameters under linux and translated the examples to window command prompt, so there might some mistakse (e.g. slashed instead of dashes) refer to the git reference manual for the exact syntax.
  • names of project dir (C:\projects\ProductA.git), branch name (ComponentA), repository location (http://reposerver.ourcompany.com/ComponentA), and submodule directory (components/ComponentA) can vary independently.