Git code version control tips: managing and pushing multiple repositories at the same time

» Toss and turn » Git code version control tips: managing and pushing multiple repositories at the same time

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

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

preface

GitHub is the most popular git code hosting website. However, due to the fact that GitHub is a foreign country, sometimes there will be network problems when downloading or pushing. Therefore, many people usually put a warehouse abroad and a warehouse in China synchronously for backup or synchronization. At present, gitee, which is an open source Chinese git code hosting system, is widely used in China, Visual inspection is about to be included in Tencent cloud's coding, alicloud's Ali code, and foreign GitHub or gitlab. We may push code to multiple warehouses at the same time. At this time, how to push code synchronously with one key is very important. In fact, it can be done with one command directly.

command

Generally, we can pass the 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 it git remote -v Command to see how many warehouses are currently in use
Git代码版本控制技巧:同时管理推送多个仓库-极客公园

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

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

Disadvantages: after testing, when git pull is used alone, only the code of the main warehouse will be pulled, and the code of other warehouses will not be pulled. Therefore, this method is more suitable for code submission only by push

Afterword

Alicloud's Ali code was discovered by Yunluo. It should belong to a member of the Alibaba cloud developer platform. As Alibaba cloud is relatively hard in China, cloud cloud cloud also synchronously hosts git code to Alibaba cloud's warehouse.

--Over--

Comment

Your email address will not be disclosed. Required item used * tagging

2. Replicate to "git code version control tips: managing and pushing multiple warehouses at the same time"