I'm developing an application that uses git, so I need to test its integration with git. Inside my git repository, I need to have another repository (my_git_repo/tests/another_repo). How can I commit it without git submodules? (I don't want to have another remote repository (in github/bitbucket, etc) for just one file)
Any ideas?
Submodules don't necessarily need to be cloned separately; you can publish a project and its submodules in a single repo. Just have a branch dedicated to the submodule contents in your main repo, then after cloning the main repo git clone -sb
the submodule directly from there.
# setup your current repo this way:
( git init sub
cd sub
> file
git add .
git commit -m-
git remote add origin ..
git push -u origin master:sub/master
)
Setup in new clone:
git branch -t sub/master origin/sub/master
git clone -sb sub/master . sub
and sub
will have the most recent content.
git rev-parse :sub
will show you what's committed for sub
-- i.e. what should be checked out there -- when you don't just want the current branch tip.
You could hook up the git submodule
command here, with a .gitmodules
file and this and that, but it hardly seems worth it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With