簡體   English   中英

如何從存儲庫中簽出分支

[英]How to checkout a branch from repository

我有一個名為'color-palette( https://github.com/3gwebtrain/color-palette.git )的存儲庫,它也有其他分支。

我想將一個名為same-color的分支克隆到我的本地系統。 但是沒有用。

我使用的命令是:

git checkout -b https://github.com/3gwebtrain/color-palette.git origin/same-color

但這是行不通的。 得到錯誤為:

fatal: Not a git repository (or any of the parent directories): .git

這是怎么了

您不只克隆git存儲庫的1個分支,而是克隆存儲庫,然后檢出該分支。

首先克隆它

git clone https://github.com/3gwebtrain/color-palette.git

然后,在該文件夾中,檢出分支

git checkout same-color

您不想在結帳時使用-b選項,因為這會創建一個新分支

我已經用以下單個git命令完成了:

git clone https://github.com/3gwebtrain/color-palette.git -b same-color --single-branch

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM