-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME
executable file
·32 lines (17 loc) · 977 Bytes
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
## 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