我想克隆這個專案https://github.com/veista/smartthings 的一個子檔案夾,即 smartthings/custom_components/smartthings 但是相關問題的所有答案都保留了 repo 結構:my-dir/smartthings/custom_components/smartthings 和我想要以下結果:my-dir/smartthings(子檔案夾,而不是 repo 根)
是否可以?
uj5u.com熱心網友回復:
如果你在一些 soda-straw 連接或按位元組付費什么的,你也可以使用過濾支持主要的 Git 托管服務支持和 Git 的核心命令,
git clone -n --filter=tree:0 https://github.com/veista/smartthings
cd smartthings
git read-tree -um @:custom_components/smartthings
并檢查您所做的另一個提交git reset --soft $thatcommit; git read-tree -um @:custom_components/smartthings。其他一切都可以以類似的方式解決。
這實際上不是 Git 的構建方式。在任何實際使用中,只獲取該死的 repo 的效率要高得多。你只想要的這個 repo 是 508KB,包括結帳;這是一個 188KB 的下載。檢查問題答案的頁面負載超過了您可以通過此節省的所有資料流量的總和,更不用說在任務上花費的人力時間和精力了。
uj5u.com熱心網友回復:
你可以:
- 克隆原始存盤庫
- 向這個本地克隆存盤庫應用一個
git filter-repo命令(基于python,要先安裝)
它包括基于路徑的過濾和重命名:
那是:
cd local/cloned/repo
git filter-repo --path custom_components/smartthings/ --path-rename custom_components/smartthings/:/
git remote set-url origin https://github.com/<me>/<newRepo>
git push
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/389528.html
標籤:混帐
上一篇:源分支是目標分支后面的兩次提交
