Skip to content

Turn one repo with many directories, into many repos and an additional superproject repo containing submodules

Notifications You must be signed in to change notification settings

nyeates/githubDirToSubmodule

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

########################
# GithubDirToSubmodule
# By Nick Yeates nyeates1 at umbc dot edu
# These set of shell scripts will automate the moving of many git 
# subdirectories in an existing git repository. It moves directories, 
# one by one, into separate repos, and then makes a submodule reference
# to that new seperate repo. The submodule is put into the original
# parent repo.
#
# Use the below workflow to use both of the files and an output.txt
# file in unison, to complete the job of transfering many directories
# over to seperate repos and submodules.
#
# See Notes in directoryList.sh and "Assumes" and "Troubleshooting"
# sections in githubDirToSubmodule.sh for additional information.
########################

Workflow
How to use the various files to turn sub-directories into separate repos and submodules

=Which sub-directories=
1) Update directoryList.sh with the 'Directory' variable referring to the repo where you have many subdirectories
2) Run directoryList.sh and examine output
 - look that all directories you want are there and look right
 - assure that each line looks like: /path/to/dir/nameOfDir nameOfDir/
3) Output to a file Ex: ./directoryList.sh > output.txt
4) Remove any directories that you dont want separated

=Change sub-directories into repos and submodules=
1) Set variables in githubDirToSubmodule.sh
 - ParentRepoPath, DirectoryListingFile. NewContainingDir, GitHubUserName, GitHubToken and SuperprojectPath
 - Assure that directories and repos exist
2) Assure that "break" is NOT commented out
 - We want to only let the loop run once in order to test it and see that it works
 - This is especially important if you have many subdirectories that you are running this on
3) Run loop once
 - ./githubDirToSubmodule.sh
 - Look for good output
4) Remove first directory from output.txt
 - We have run it on this first one, and so now only need to run it on the others
5) Run script on all other directories
 - remove the "break" to do this
 - ./githubDirToSubmodule.sh

About

Turn one repo with many directories, into many repos and an additional superproject repo containing submodules

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages