git克隆某個分支到本地指定的目錄中


通過git clone命令可以將遠程git倉庫拉取到本地。

如果想要只是拉取某個分支,並且將拉下來的代碼放到指定本地目錄中,使用如下的命令:

git clone --branch br01 http://172.20.58.152:8088/zhai01/test.git br01

參數釋義:

--branch 指定分支的名字(br01)

br01:命令最后的br01是本地的目錄名字,如果不指定就和倉庫名字一樣的目錄,這里是test

執行過程:

[root@nctest-snap-test-02 apps]# git clone --branch br01 http://172.20.58.152:8088/zhai01/test.git br01
Cloning into 'br01'...
Username for 'http://172.20.58.152:8088': zhai01
Password for 'http://zhai01@172.20.58.152:8088': 
remote: Enumerating objects: 23, done.
remote: Counting objects: 100% (23/23), done.
remote: Compressing objects: 100% (11/11), done.
remote: Total 23 (delta 6), reused 23 (delta 6), pack-reused 0
Unpacking objects: 100% (23/23), done.

查看本地目錄

[root@test-snap-test-02 apps]# ls -l br01/
total 24
-rwxr-xr-x 1 root root 17 Jan  6 16:12 br01.sh
-rwxr-xr-x 1 root root 17 Jan  6 16:12 br02.sh
-rwxr-xr-x 1 root root  4 Jan  6 16:12 br03.sh
-rwxr-xr-x 1 root root 12 Jan  6 16:12 br04.sh
-rwxr-xr-x 1 root root 12 Jan  6 16:12 install.sh
-rw-r--r-- 1 root root  8 Jan  6 16:12 README.md
[root@test-snap-test-02 apps]# 

已經將br01分支的內容放入到本地的br01目錄中。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM