Comment fusionner deux dépôts Git

Mots clés : gitmergerepositorygit-subtreegit

meilleur 5 Réponses Comment fusionner deux dépôts Git

vote vote

90

cd path/to/project-b git remote add project-a /path/to/project-a git fetch project-a --tags git merge --allow-unrelated-histories project-a/master # or whichever branch you want to merge git remote remove project-a 
cd path/to/project-a git filter-repo --to-subdirectory-filter project-a 
vote vote

88

git remote add -f Bproject /path/to/B git merge -s ours --allow-unrelated-histories --no-commit Bproject/master git read-tree --prefix=dir-B/ -u Bproject/master git commit -m "Merge B project as our subdirectory" git pull -s subtree Bproject master 
vote vote

72

git subtree add --prefix=rails git://github.com/rails/rails.git master 
git log <rev> git blame <rev> -- README.md 
# finishes with all files added at once commit git log rails/README.md  # then continue from original tree git log <rev> -- README.md 
vote vote

60

git remote add projb [wherever] git pull projb 
vote vote

60

git log projectA 
PREFIX=projectA #adjust this  git filter-branch --index-filter '     git ls-files -s |     sed "s,\t,&'"$PREFIX"'/," |     GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index --index-info &&     mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE ' HEAD 
git pull path/to/A 

Questions similaires