Skip to content

Latest commit

 

History

History
40 lines (30 loc) · 1011 Bytes

git-submodule.md

File metadata and controls

40 lines (30 loc) · 1011 Bytes

Git Submodules

## Add
git submodule add https://github.com/chaconinc/DbConnector

git status

git diff --cached DbConnector
git diff --cached --submodule

git commit -am 'Add DbConnector module'
git push origin main

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

## Pulling in Upstream Changes from the Submodule Remote
cd module-dir && git fetch
cd main-dir && git diff --submodule
git config --global diff.submodule log
git diff
## one-liner (Git will go into your submodules and fetch and update for you.)
git submodule update --remote DbConnector

## specify default branch to point to 'stable'
git config -f .gitmodules submodule.DbConnector.branch stable

git config status.submodulesummary 1
git status
git diff
git log -p --submodule

## Pushing
## Commit in the main project and push it up with the submodule changes
git push --recurse-submodules=check