README.md (1349B)
1 # git-submodule-integrate 2 3 This script automates the process of copying a git repository into a 4 subdirectory of another git repository, and preserving its history. Since git 5 submodules are just git repositories, the script can be used to incorporate a 6 submodule and its history into a parent repository. 7 8 ## Usage 9 10 The script acts on two repositories: the parent repo and the child repo. Once 11 the script has been run, the parent repo will contain the child repo in a 12 subdirectory. 13 14 First, you'll need copies of the parent and child repositories in separate 15 directories. So if the child repository is a submodule, you'll need to clone it 16 into its own repo, outside of the parent. We will assume that `$PARENT` is the 17 path to the parent repository and `$CHILD` is the path to the child repository. 18 19 Next, download the script somewhere. We will assume the path of the script is 20 `$GSI`. 21 22 Now set your working directory to the parent repository 23 24 ``` 25 $ cd $PARENT 26 ``` 27 28 If you're trying to integrate a submodule, you need to remove the submodule from 29 the parent repository. This can be accomplished with 30 31 ``` 32 $ git rm path/to/submodule && git commit 33 ``` 34 35 Now pick a name for the subdirectory `$DEST` where you want the child repository 36 to be placed and run 37 38 ``` 39 $ $GSI $CHILD $DEST 40 ``` 41 42 Depending on the size of your repo and commits, it may take a while.