Created
September 29, 2020 00:49
-
-
Save mcascardi/f01ad7eeec25f08c1b1ebc7100a5e16c to your computer and use it in GitHub Desktop.
Process for removing a git submodule and merging the history back into the parent repo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Gratitude: https://stackoverflow.com/questions/1759587/how-to-un-submodule-a-git-submodule | |
| origin=submodule_origin | |
| url=git://url/to/submodule/origin | |
| path=submodule_path | |
| echo "git remote add $origin $url" | |
| echo "git fetch $origin" | |
| echo "git merge -s ours --no-commit --allow-unrelated-histories $origin/master" | |
| echo "git rm --cached $path" | |
| echo "-- GO AHEAD REMOVE FROM THE SUBMODULE FILE --" | |
| echo "git add .gitmodules" | |
| echo "rm -rf $path/.git" | |
| echo "git add $path" | |
| echo "git commit" | |
| echo "git push" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment