Skip to content

Instantly share code, notes, and snippets.

@prezire
Created October 23, 2019 07:28
Show Gist options
  • Save prezire/bbdfa4c983834175a025498d3d5e57ef to your computer and use it in GitHub Desktop.
Save prezire/bbdfa4c983834175a025498d3d5e57ef to your computer and use it in GitHub Desktop.
Basic Git Submodule Commands
#Main proj.
#Add a submodule.
git submodule add https://proj.git
#Go to submodule's dir and change to specific branch.
cd submodule_dir
git checkout -b branch origin/branch
#Go back to proj root and push to repo along with the new submodule's new branch.
git add . -u
git commit ...
git push
#Forking proj.
git checkout -b branch origin/branch
#Use the submodule that the main proj is using.
git submodule update --init
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment