簡體   English   中英

GitHub:如何將公共存儲庫作為私有存儲庫中的子目錄進行分叉?

[英]GitHub: How to fork a public repository as a subdirectory in a private repository?

我的項目目前托管在私有存儲庫中。 我正在尋找對 GitHub 上公共存儲庫中托管的第三方庫的依賴項。我如何分叉該庫,使其成為我項目中的子目錄,但我仍然可以從該庫的主干分支同步?

這稱為子模塊,在http://git-scm.com/book/en/Git-Tools-Submodules中有詳細描述

這個順序會讓你設置:

cd <my-project-dir>
git submodule add <github repository> <my-third-party-dir>   # -b <branch> optionally
git submodule init
git submodule update

此時,您的my-third-party-dir已經填充了一個特定的提交(一個分離的頭部)。 您的項目將有兩個更改。

git add .gitmodules <my-third-party-dir>
git commit -m 'Added <repository> as a submodule'

暫無
暫無

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

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