[英]How can I add commits from submodules to main repository
我有一個包含一個子模塊的存儲庫。
但我希望在主存儲庫中使用的標記中通知子模塊中的提交。
是否可以執行此程序?
注意:我使用 Jenkins 工具進行構建、部署,它有一個創建標簽的階段。
我一直在嘗試以下命令:
此命令不會將提交放在標簽上
git submodule update --init --recursive --remote
此命令返回消息:Entering 'SUBMODULE/FOLDER'
git submodule foreach --recursive 'git fetch --tags --force'
您可能已經在“git status”中注意到,有時子模塊讀取為已修改。
那是因為在該子模塊目錄中簽出的提交已更改。
當你git add path/to/submodule
和git commit
a change to a submodule in the parent project, it records the hash that submodule is checked out to. 如果您隨后提交該更改,它會提交“子模塊狀態”。
submodule update
與--remote
一起使用! 使用git submodule update --init --recursive
代替(在父項目中)。 這將檢出保存在父項目提交中的 state 的所有子模塊。
使用--remote
會破壞子模塊 state 的任何保證。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.