-
-
Save danielsdeleo/65b4fc4fe86ce7e9a1d9 to your computer and use it in GitHub Desktop.
nested git repos make dan want to drink before noon
This file contains 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
# create the top-level project: | |
mkdir superproject | |
cd superproject | |
touch hello | |
git init . | |
git add . | |
git ci -m 'initial' | |
# create a git repo inside that: | |
mkdir subproject | |
cd subproject | |
touch hello-subproject | |
git init . | |
git add . | |
git ci -m 'initial (subproject)' | |
cd .. | |
# if you add everything to the index, like this: | |
git add . | |
# Now git treats 'subproject' like a submodule: | |
git submodule status | |
# make git forget subproject (undo `git add`): | |
git reset HEAD subproject | |
# verify it's untracked: | |
git st | |
# if you add the directory like this (with trailing slash): | |
git add subproject/ | |
# then you can add the non-git files. See: | |
git st | |
git ls-files | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment