I have a git repo which has some subdirectories:
~/src
~/src/.git
~/src/mystuff
~/src/otherstuff
Now I want to share otherstuff
with a friend, I was planning to do this with bitbucket. They should be able to clone it and push changes in otherstuff
but I don't want them to be able to access src
, mystuff
(nor even see that they exist).
How do I go about this? I almost went into cd ~/src/otherstuff
and did git init
, git remote add origin ssh://[email protected]/wim_glenn/...
but something doesn't smell right about doing git init again when it's already under version control.
Making a git init
within a git repo works: the directory in which you init the nested repo simply becomes ignored by the parent repo.
However, if the history of that subdirectory is important, is is best to export it as a separate repo (as Nick suggested).
From there, you can keep both repos in lock steps by declaring that new repo as a submodule of the parent repo.
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