Skip to content

Instantly share code, notes, and snippets.

View lukipedio's full-sized avatar
🎯
Focusing

Luca Colombini lukipedio

🎯
Focusing
  • CAEN S.p.A.
  • Italy
View GitHub Profile
@lukipedio
lukipedio / git_submodule_replacement.md
Last active September 30, 2021 15:55 — forked from MJeorrett/git_submodule_replacement.md
Replace directory with git submodule

These are the steps required to replace a directory with a submodule in git. Note: Assumes that you are currently working on branch called 'develop'

  1. Check out a new branch to make the changes on: git checkout -b creating-submodule
  2. delete directory to be replaced rm -rf path/of/directory/to/be/replaced
  3. git add . then git commit -m "removing local directory"
  4. add the submodule: git submodule add "https://github.com/repoName" path/of/directory/to/be/replaced
  5. git add . then git commit -m "adding submodule"
  6. delete the submodule directory if you don't do this git will throw a hissy when you try to checkout out develop to merge the changes in
  7. git checkout develop
  8. git merge creating-submodule
{"version":1,"resource":"file:///c%3A/work/acquisition_subsystem_dpp/component.xml","entries":[{"id":"oPWf.xml","timestamp":1652279028590},{"id":"p2Za.xml","timestamp":1652962315961},{"id":"vlQb.xml","timestamp":1652962442022}]}