Reputation: 699
I am (obviously) new to git. Here is my scenario. I have a local git repository (server that I maintain) setup for my project. I want to create create a sub-directory e.g. oss-project under my repository. And I want to get (copy) a project on github into that directory. I need to be able to: 1. maintain the commit history on the github project into my repository as well. 2. selectively pull any updates to the oss-project on github in future.
could you advise, what steps do i need to take to achive that?
git clone http://my-local-repo/my-project.git
cd my-project
md oss-project
cd oss-project
// How do i proceed ? git clone / fork the oss-project??
thanks for the help!
Upvotes: 0
Views: 365
Reputation: 12629
To create the oss-project submodule in the oss-project subfolder:
git submodule add git@github:user/oss-project.git oss-project
Assuming you have SSH access to oss-project. If not, use a http/git URL for read-only access.
Later if you want to use the newest version of oss-project:
cd oss-project
git checkout master
git pull origin master
cd ..
git add oss-project
git commit
Monsters ahead: git submodules are hard to remove.
Upvotes: 1
Reputation: 8029
You can use a git submodule or you can look at some alternatives.
Upvotes: 0