ขั้นตอนการทำงานด้านล่างเพิ่มพื้นที่เก็บข้อมูล GitHub เป็น AA ระยะไกลใหม่ที่เรียกว่าsyncและ bitbucket originระยะไกลเป็น นอกจากนี้ยังเพิ่มสาขาที่เรียกว่าgithubเพื่อติดตามพื้นที่เก็บข้อมูล github และสาขาที่เรียกว่าmasterเพื่อติดตามพื้นที่เก็บข้อมูล bitbucket มันถือว่าคุณมีพื้นที่เก็บข้อมูลบิตบิตที่เรียกว่า "myrepository" ซึ่งว่างเปล่า
รีโมทติดตั้ง
# setup local repo
mkdir myrepository
cd myrepository
git init
# add bitbucket remote as "origin"
git remote add origin ssh://git@bitbucket.org/aleemb/myrepository.git
# add github remote as "sync"
git remote add sync https://github.com/aleemb/laravel.git
# verify remotes
git remote -v
# should show fetch/push for "origin" and "sync" remotes
สาขาการติดตั้ง
# first pull from github using the "sync" remote
git pull sync
# setup local "github" branch to track "sync" remote's "master" branch
git branch --track github sync/master
# switch to the new branch
git checkout github
# create new master branched out of github branch
git checkout -b master
# push local "master" branch to "origin" remote (bitbucket)
git push -u origin master
ตอนนี้คุณควรจะมีในท้องถิ่นgithubติดตาม repo GitHub สาขาmasterสาขา และคุณควรจะมีmasterสาขาท้องถิ่นติดตาม repo bitbucket ( masterสาขาโดยค่าเริ่มต้น)
สิ่งนี้ทำให้ง่ายต่อการดึงgithubสาขาจากนั้นรวมการเปลี่ยนแปลงเหล่านั้นเข้ากับmasterสาขา (ต้องการmasterให้รีบูตมากกว่าการรวม) จากนั้นคุณสามารถกดสาขา (จะดันมันเป็นบิต)