git clone --depth=1 后獲取其他分支


1.先轉換存儲庫為完整存儲庫

git pull --unshallow
#或者
git fetch  --unshallow

此命令用於 將淺層轉換為完整的存儲庫,消除淺層存儲庫所施加的所有限制

2.修改.git文件夾內config文件的[remote "origin"]節的內容

修改前
[remote "origin"]
    url = https://xxx.com/abc/xxx.git
    fetch = +refs/heads/master:refs/remotes/origin/master

修改后

[remote "origin"]
    url = https://xxx.com/abc/xxx.git
    fetch = +refs/heads/*:refs/remotes/origin/*

以上步驟也可用命令代替

git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"

3.然后執行以下命令獲取所有分支

git fetch -pv

 

參考:https://www.cnblogs.com/pansidong/p/11294128.html

https://www.cnblogs.com/chucklu/p/4971686.html


免責聲明!

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



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