github - Git - how best to store multiple repositories inside one master repository? -


i moving lot of projects private repositories in github. lot of these projects no longer actively in use. such, i'd rather not have dedicated repository per each of these projects - i'd lump them 1 'deprecated projects' repository. , maintain history of each individual project.

i've tried placing project directories, along .git directories, main deprecated projects repository, doesn't seem work - directory seems tracked/versioned in main repository, none of it's files.

what best option available me in situation? have tried renaming .git directories in sub-directories / projects .git-directory, , seems though removes problem - files in projects added main repository correctly. if indeed work want, acceptable solution - having rename .git-directory folder .git if did want move project out of 'deprecated repositories' repo, , start active development on again. if can confirm whether approach okay, or result in problems, useful.

i'm pretty new, information on appreciated!

use subtree merging.

summary

subtree merging allows keep history of every project, , latest commit have each project in separate directory. ideal if projects inactive.

you can brows history in gitk normal, , sha-1 hashes preserved.

mechanics

suppose have master repo in master-repo , project merge in project. here steps:

 cd master-repo git remote add project1 ../project1 git fetch project1 git merge -s ours --no-commit project1/master git read-tree --prefix=project1 -u project1/master git commit -m "added project 1" 

in other words,

  1. add project remote, can bring history in master repository.
  2. merge project master repository, use merge strategy ignores files project. allows make merge commit without changing files, allows explore history later.
  3. bring in project files subdirectory, , commit.

note, itself, not preserve branches projects other "master". can preserve them putting them in other subdirectories, or can skip read-tree step , make merge commits without bringing in files branches.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -