git同步遠端倉庫的所有分支

2021-10-06 19:34:24 字數 2286 閱讀 2944

#找乙個乾淨目錄,假設是clone

cd clone

#轉殖遠端專案 shape_based_matching.git

git clone

#等價於 git checkout -b master origin/master

#這樣在clone目錄下得到乙個shape_based_matching子目錄

#進入shape_based_matching資料夾

cd shape_based_matching

git branch -a

#列出所有分支名稱如下:

* master

remotes/origin/head -> origin/master

remotes/origin/fusion_by_hand

remotes/origin/icp2d

remotes/origin/inv_light

remotes/origin/master

remotes/origin/python_binding

remotes/origin/rotate_templ

remotes/origin/sim3

remotes/origin/subpixel

git checkout -b fusion_by_hand origin/fusion_by_hand

#作用是checkout遠端的fusion_by_hand分支,在本地起名為fusion_by_hand分支,並切換到本地的fusion_by_hand分支

....

..#作用參見上一步解釋

git checkout -b subpixel origin/subpixel

git branch -a

#列出所有分支名稱如下:

fusion_by_hand

icp2d

inv_light

master

python_binding

rotate_templ

sim3

* subpixel

remotes/origin/head -> origin/master

remotes/origin/fusion_by_hand

remotes/origin/icp2d

remotes/origin/inv_light

remotes/origin/master

remotes/origin/python_binding

remotes/origin/rotate_templ

remotes/origin/sim3

remotes/origin/subpixel

#切換回master分支,並開始開發。

git checkout master

git clone ******

cd ***

git branch -r |

grep -v '\->'

|while

read remote;

dogit branch --track "$"

"$remote"

;done

git fetch --all

git pull --all

具體步驟

#找乙個乾淨目錄,假設是clone

cd clone

#轉殖遠端專案 shape_based_matching.git

git clone

#等價於 git checkout -b master origin/master

#這樣在clone目錄下得到乙個shape_based_matching子目錄

#進入shape_based_matching資料夾

cd shape_based_matching

#跟蹤其他分支

git branch -r |

grep -v '\->'

|while

read remote;

dogit branch --track "$"

"$remote"

;done

#更新所有分支

git fetch --all

git pull --all

#隨意切換各個分支

#切換回master分支,並開始開發。

git checkout master

#切換回fusion_by_hand分支,並開始開發。

git checkout fusion_by_hand

git 從遠端倉庫獲取所有分支

git如何clone所有的遠端分支 git clone只能clone遠端庫的master分支,無法clone所有分支,解決辦法如下 找乙個乾淨目錄,假設是git work cd git work git clone 這樣在git work目錄下得到乙個project子目錄 cd project gi...

git 從遠端倉庫獲取所有分支

git如何clone所有的遠端分支 git clone只能clone遠端庫的master分支,無法clone所有分支,解決辦法如下 找乙個乾淨目錄,假設是git work cd git work git clone 這樣在git work目錄下得到乙個project子目錄 cd project gi...

Git從遠端倉庫獲取所有分支

git clone只能clone遠端庫的master分支,無法clone所有分支,解決辦法如下 本地新建workspace目錄 cd workspace git branch a,列出所有分支名稱如下 master remotes origin develop remotes origin rele...