Here's the problem I needed to solve: a group needed their own Git area to work in. We wanted to be able to work in our own Git trees without breaking each other's tree.
We are running gitolite on our corporate Git servers. We can't add repos without going through an administrator.
We have an automated build server that fetches the entire Git repo. The more branches in the repo, the longer it takes to fetch and the longer each automated build takes.
The solution was to create a new set of repos, parallel to the original "main" repos. (Our gitolite admin created those repos for us.) Now, how to get the current code from the main repo to the second group's new repos?
https://stackoverflow.com/questions/17371150/moving-git-repository-content-to-another-repository-preserving-history
# get the new repo (currently empty)
git clone git@gitolite:new-group-dev/reponame reponame
# should now have an empty tree called "reponame"
# cd reponame
# add the secondary repo
git remote add r1remote git@gitolite:old-group-dev/other-repo-name
# fetch the secondary repo code
git fetch r1remote
# and at this point the command diverge from the Stack Overflow. I'm pulling in the branch I created
# that the other group is going to start from.
git merge r1remote/b/dpoole/davesbranch
# all my code should now be in the current directory
# do NOT 'git remote rm' the r1remote; we want to be able to merge changes from it
# push code to new-group-dev/reponame on the gitolite server
git push origin master
# we should have two remotes.
% git remote -v
origin git@gitolite:new-group-dev/reponame (fetch)
origin git@gitolite:new-group-dev/reponame (push)
r1remote git@gitolite:old-group-dev/other-repo-name (fetch)
r1remote git@gitolite:old-group-dev/other-repo-name (push)
# TODO update this post when we start cross merging. That should be fun!