Skip to content

Instantly share code, notes, and snippets.

@danielsdeleo
Last active August 29, 2015 14:02
Show Gist options
  • Save danielsdeleo/65b4fc4fe86ce7e9a1d9 to your computer and use it in GitHub Desktop.
Save danielsdeleo/65b4fc4fe86ce7e9a1d9 to your computer and use it in GitHub Desktop.
nested git repos make dan want to drink before noon
# 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