Git code version control skill: manage and push multiple warehouses at the same time

» Technical toss » Git code version control skill: manage and push multiple warehouses at the same time

Git is a popular version control system. Through Git, we can manage code, managed code, manage our own works, and synchronously push multiple version databases by adding remote repositories

Git代码版本控制技巧:同时管理推送多个仓库-极客公园

preface

Github is the most popular Git code hosting website. However, given that Github is a foreign website, sometimes there will be network problems when downloading or pushing. So many people usually put a warehouse abroad and a warehouse at home for backup or synchronization. At present, the domestic Git code hosting system has the Gitee of open source China, Visually, we will include Tencent Cloud's Coding, AliCloud's Ali Code, and Github or Gitlab abroad. We may push the code to multiple warehouses at the same time. At this time, it is very important to push the code synchronously with one click, which can be done directly with one command.

command

Generally, we can git clone To download a code base

 git clone  git@code.aliyun.com :sp91/Payjs4Woo.git

We can think of this warehouse as the main warehouse, and then add several sub warehouses

 git remote set-url --add origin  git@code.aliyun.com :sp91/Payjs4Woo.git

Then we can use git remote -v Command to view how many warehouses there are
Git代码版本控制技巧:同时管理推送多个仓库-极客公园

In the above figure, the main warehouse is in the red box, and the others are sub warehouses.
If there is no problem, we can submit push, as shown below
Git代码版本控制技巧:同时管理推送多个仓库-极客公园

As can be seen from the figure, it is very convenient to submit code to four code repositories at one time.

Disadvantages: After testing, when using git pull alone, only the code of the main warehouse will be pulled, not the code of other warehouses, so this method is more suitable for the operation of submitting code only using push

Postscript

AliCloud discovered AliCloud's AliCloud code, which should belong to the AliCloud developer platform. Since AliCloud is relatively hard in China, AliCloud also synchronously hosts Git code to AliCloud's warehouse.

--End--

Post reply

Your email address will not be disclosed. Required items have been used * tagging

2 Replies to "Git code version control technique: managing multiple warehouses at the same time"