Mithril
Mithril

Reputation: 13718

git add an existing git folder to parent project

I have a project in github, I want to include that project to my company's big project.
Structure like as (bigproject must conatin myproject's files):

bigproject/.git
bigproject/myproject/.git

I clone my project to bigproject/myproject/.git, and git add . under bigproject. That command just add myproject folder without the contain.

I'd like to update myproject on github, and just add change to my company's bigproject.I search around and find git submodule, but the official document is not obvious.
What should I do?

The expected follow is:

bigproject/myproject/.git     git pull origin master
bigproject/.git               git add .
bigproject/.git               git push

Upvotes: 0

Views: 156

Answers (1)

joran
joran

Reputation: 2883

In the root of bigproject you may add myproject as a submodule of bigproject

git submodule add <url to myproject repo> myproject`
git add .
git commit -m "adding myproject"
git submodule init
git submodule update

Upvotes: 1

Related Questions