/ExLib

Random Examples of Various Library Functionality

Primary LanguageC++

## Collecting Example Repos

#### Merging Repos

http://stackoverflow.com/questions/13040958/merge-two-git-repositories-without-breaking-file-history

Here's a way that doesn't rewrite any history, so all commit IDs will remain valid. The end-result is that the second repo's files will end up in a subdirectory.

1. Add the second repo as a remote:

   cd firstgitrepo/
   git remote add -f secondrepo username@servername:andsoon

2. Create a local branch from the second repo's branch:

   git branch branchfromsecondrepo secondrepo/master; git checkout branchfromsecondrepo

3. Move all its files into a subdirectory:

   mkdir subdir/
   git ls-tree -z --name-only HEAD | xargs -0 -I {} git mv {} subdir/

4.  Merge the second branch into the first repo's master branch:

   git commit -m "STYLE: organizing files"; git checkout master; git merge branchfromsecondrepo

5. clean up

   git branch -D branchfromsecondrepo; git remote rm secondrepo

6. git log --follow file