Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 979 Bytes

update_submodule.md

File metadata and controls

32 lines (22 loc) · 979 Bytes

Updating a submodule

Working with submodules it not something I do a lot, so I tend to forget how to go about it - so here goes.

I expect you have initialized or want to initialize a submodule in your Git repository.

# Add the submodule initially
$ git submodule add ssh://bla example_submodule_directory
$ git submodule init

At some point in time you want to update it.

# Go to the submodule directory, do note the example is named naively for the purpose of demonstration
$ cd example_submodule_directory

# Check out desired branch
$ git checkout master
$ git pull

# Go back to your project root, your tree structure might be deeper, so this is just a basic example
$ cd ..

# Now you can commit these changes to your project
$ git commit -am "Pulled down update to submodule: example (example_submodule_directory)"

References