Reputation: 145
i have a folder with two git-repository, say "rcr-internals" and "prv.project.repository.bare".
I have to move (copy) only one project from one repository to other.
With other words - "prv.project.repository.bare/project_1" have to be copied to "rcr-internals/project_1".
At last i need to have the change history in "rcr-internals"-repository
i have tried to do the following:
admin@linux:~/git/rcr-internals> git clone file://..prv.project.repository.bare/project_1/
but it doesn't work
is it possible to do it and how to do it?
thank for assistance
Upvotes: 0
Views: 115
Reputation: 142572
You simply need to add the remote(s) to your project. Once you have added the remotes you can do what you want with it
http://git-scm.com/book/en/Git-Basics-Working-with-Remotes#Adding-Remote-Repositories
git remote add <origin2> <url2>
Now you can pull and merge the branches from the 2 remotes and have the code of both of them in a single repository.
As you can see in the image below you will have 2 repositories which builds up your big repository.
# clone first repository
git clone <repo1>
# add remote
git remote add <remote2> <url2>
# fetch all your data from all the remotes
git fetch --all --prune
# list of all the remotes
git remote -v
Upvotes: 0
Reputation: 719
you don't have to clone repository prv.project.repository.bare to copy folder. You may add repository as a remote and then checkout project_1 from required branch. Something like below:
git remote add prv <url of prv.project.repository.bare>
git fetch prv
git checkout prv/<branch_name> -- project_1
Upvotes: 2