Post

Git Submodule

How git submodule works?

git submodule sync

git submodule update

Common Usage

https to ssh

  1. Edit the .gitmodules file
    1
    2
    
    [submodule "path/to/submodule"]
     url = https://github.com/user/repo.git
    

    Change it to:

    1
    2
    
    [submodule "path/to/submodule"]
     url = git@github.com:user/repo.git
    
  2. Update the submodule configuration
    1
    
    git submodule sync
    
  3. git config --edit to see the effects
  4. Pull the latest changes
    1
    
    git submodule update --init --recursive
    

References

This post is licensed under CC BY 4.0 by the author.