gitリモートサーバの追加

834 ワード

プロジェクトの必要性のため、同じコードも別の外部サーバのバージョンを維持する必要があります.gitのリモートサーバを使用することができます.
まず、ローカルのリモート・サーバのコマンドを表示します.
git remote -v

origin	[email protected]:/home/drivesim/test.git/ (fetch)
origin	[email protected]:/home/drivesim/test.git/ (push)


リモートサーバ命令の追加
git remote add lab [email protected]:/home/code/test.git

追加後に表示
git remote -v

lab	[email protected]:/home/code/test.git (fetch)
lab	[email protected]:/home/code/test.git (push)
origin	[email protected]:/home/drivesim/test.git/ (fetch)
origin	[email protected]:/home/drivesim/test.git/ (push)

後でローカルの現在のブランチを別のリモートサーバのmasterブランチにプッシュしたい場合は、このようにすることができます.
git push lab HEAD:master

リモート固有のブランチからコードを引くこともできます
git pull lab master