3

So I'm having this project where some parts have been developed in the main repo but can be moved to an independently developed sub-module :

./                       ← repo root
├── client-angular/
│   └── whatever/
├── resources/
│   └── script/          ← wanna be sub-module
└── server-codeigniter/

Question

How can I make the script/ directory into a git submodule with minimal effort ? It is currently tracked by the main repo.

Édouard Lopez
  • 36,430
  • 24
  • 114
  • 170
  • Possible duplicate of http://stackoverflow.com/questions/359424/detach-subdirectory-into-separate-git-repository – Gary Fixler Mar 04 '14 at 14:48

1 Answers1

2

Once you have extracted the sub-folder in its own repo (as explained in "Detach (move) subdirectory into separate Git repository"), you will still have to:

  • push that new repo on a remote server (GitHub for instance)
  • git rm -r resources/script
  • and add the remote new repo as a submodule

    git submodule add /url/new/repo resources/scripts
    
VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755