Python / Odoo Developer

Welcome!

This community is for professionals and enthusiasts of our products and services. Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.

0

GIT Submodules

Avatar
Administrator

Open 

Open Alternative

Add submodule

https://www.vogella.com/tutorials/GitSubmodules/article.html

git submodule add -b [BRANCH_NAME] https://github.com/OmniaGit/odooplm.git [SUBMODULE_NAME]
git submodule init
git submodule update
git pull --recurse-submodules
git submodule update --init --recursive

To check that child submodule is pulling

Remove submodule

https://www.freecodecamp.org/forum/t/how-to-remove-a-submodule-in-git/13228

  1. Delete the section referring to the submodule from the .gitmodules file

  2. Stage the changes via git add .gitmodules

  3. Delete the relevant section of the submodule from .git/config.

  4. Run git rm --cached path_to_submodule (no trailing slash)

  5. Run rm -rf .git/modules/path_to_submodule

  6. Commit the changes with git commit -m "Removed submodule "

  7. Delete the now untracked submodule files rm -rf path_to_submodule

Clone Project With Submodules

  •  $ git clone https://github.com/chaconinc/MainProject

    Cloning into 'MainProject'...

    remote: Counting objects: 14, done.

    remote: Compressing objects: 100% (13/13), done.

    remote: Total 14 (delta 1), reused 13 (delta 0)

    Unpacking objects: 100% (14/14), done.

    Checking connectivity... done.

    $ cd MainProject

    $ ls -la

    total 16

    drwxr-xr-x   9 schacon  staff  306 Sep 17 15:21 .

    drwxr-xr-x   7 schacon  staff  238 Sep 17 15:21 ..

    drwxr-xr-x  13 schacon  staff  442 Sep 17 15:21 .git

    -rw-r--r--   1 schacon  staff   92 Sep 17 15:21 .gitmodules

    drwxr-xr-x   2 schacon  staff   68 Sep 17 15:21 DbConnector

    -rw-r--r--   1 schacon  staff  756 Sep 17 15:21 Makefile

    drwxr-xr-x   3 schacon  staff  102 Sep 17 15:21 includes

    drwxr-xr-x   4 schacon  staff  136 Sep 17 15:21 scripts

    drwxr-xr-x   4 schacon  staff  136 Sep 17 15:21 src

    $ cd DbConnector/

    $ ls

  • The DbConnector directory is there, but empty. You must run two commands: git submodule init to initialize your local configuration file, and git submodule update to fetch all the data from that project and check out the appropriate commit listed in your superproject

  • $ git submodule init

    Submodule 'DbConnector' (https://github.com/chaconinc/DbConnector) registered for path 'DbConnector'

    $ git submodule update

    Cloning into 'DbConnector'...

    remote: Counting objects: 11, done.

    remote: Compressing objects: 100% (10/10), done.

    remote: Total 11 (delta 0), reused 11 (delta 0)

    Unpacking objects: 100% (11/11), done.

    Checking connectivity... done.

    Submodule path 'DbConnector': checked out 'c3f01dc8862123d317dd46284b05b6892c7b29bc'


Clone Project With Submodules 2

$ git clone --recurse-submodules https://github.com/chaconinc/MainProject

Cloning into 'MainProject'...

remote: Counting objects: 14, done.

remote: Compressing objects: 100% (13/13), done.

remote: Total 14 (delta 1), reused 13 (delta 0)

Unpacking objects: 100% (14/14), done.

Checking connectivity... done.

Submodule 'DbConnector' (https://github.com/chaconinc/DbConnector) registered for path 'DbConnector'

Cloning into 'DbConnector'...

remote: Counting objects: 11, done.

remote: Compressing objects: 100% (10/10), done.

remote: Total 11 (delta 0), reused 11 (delta 0)

Unpacking objects: 100% (11/11), done.

Checking connectivity... done.

Submodule path 'DbConnector': checked out 'c3f01dc8862123d317dd46284b05b6892c7b29bc'

Update submodules

git submodule init
git submodule update --remote
cd Submodule Name
git pull
git add Submodule Name
git commit -m "Update submodule"
git push


Avatar
Discard