code_junkie

Combining multiple git repositories

Nov 12th, 2011
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. phd/code/
  2. phd/figures/
  3. phd/thesis/
  4.  
  5. cd phd/code
  6. git commit
  7. cd ../figures
  8. git commit
  9.  
  10. cd phd
  11. git commit
  12.  
  13. cd phd
  14. git init
  15. git add [[everything that's already in my other repositories]]
  16.  
  17. $ cp -r phd phd-backup
  18.  
  19. $ cd phd/code
  20. $ git filter-branch --index-filter
  21. 'git ls-files -s | sed "s-t-&code/-" |
  22. GIT_INDEX_FILE=$GIT_INDEX_FILE.new
  23. git update-index --index-info &&
  24. mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' HEAD
  25.  
  26. phd
  27. |_code
  28. | |_.git
  29. | |_code
  30. | |_(your code...)
  31. |_figures
  32. | |_.git
  33. | |_figures
  34. | |_(your figures...)
  35. |_thesis
  36. |_.git
  37. |_thesis
  38. |_(your thesis...)
  39.  
  40. $ cd phd
  41. $ git init
  42.  
  43.  
  44. $ git pull code
  45. $ rm -rf code/code
  46. $ rm -rf code/.git
  47.  
  48.  
  49. $ git pull figures
  50. $ rm -rf figures/figures
  51. $ rm -rf figures/.git
  52.  
  53.  
  54. $ git pull thesis
  55. $ rm -rf thesis/thesis
  56. $ rm -rf thesis/.git
  57.  
  58. phd
  59. |_.git
  60. |_code
  61. | |_(your code...)
  62. |_figures
  63. | |_(your figures...)
  64. |_thesis
  65. |_(your thesis...)
  66.  
  67. $ cd phd/code
  68. $ git mv code code-repository-migration
  69. $ git commit -m "preparing the code directory for migration"
  70.  
  71. $ cd phd
  72. $ git mv code/code-repository-migration code/code
  73. $ git commit -m "final step for code directory migration"
  74.  
  75. $ cd phd/code
  76. $ mkdir code
  77. # This won't work literally, because * would also match the new code/ subdir, but you understand what I mean:
  78. $ git mv * code/
  79. $ git commit -m "preparing the code directory for migration"
  80.  
  81. $ cd ../..
  82. $ mkdir phd.all
  83. $ cd phd.all
  84. $ git init
  85. $ git pull ../phd/code
  86. ...
  87.  
  88. git init
  89. git add *
  90. git commit -a -m "import everything"
  91.  
  92. Rewrite 422a38a0e9d2c61098b98e6c56213ac83b7bacc2 (1/42)mv: cannot stat `/home/.../wikis/nodows/.git-rewrite/t/../index.new': No such file or directory
Add Comment
Please, Sign In to add comment