-
按照这个文档fork,修改envoy后提交到envoy-1.27分支,但是主项目中子模块的分支是detached状态,无法更新,如果在子模块中强行切换到envoy-1.27分支,能把子模块更新到最新版本,但是会报"正在丢弃xx个提交",所以请教下我应该如何把最新的envoy变更拉下来,而且不丢弃提交呢? |
Beta Was this translation helpful? Give feedback.
Replies: 17 comments
-
在子模块里创建一个新分支,然后提交改动,再到主仓库里提交对子模块的改动即可。 |
Beta Was this translation helpful? Give feedback.
-
"再到主仓库里提交对子模块的改动",这里首先得拿到子模块的改动,但是现在的问题是在主仓库里面获取子模块的改动会有上面提到的问题。网上找的一些子模块工作模式貌似并不奏效,跟higress的模式好像不太一样 |
Beta Was this translation helpful? Give feedback.
-
你先执行 |
Beta Was this translation helpful? Give feedback.
-
我是执行了make prebuild的,子模块也拉下来了,envoy子模块处于detach状态。接下来按你的操作,"再到主仓库里提交对子模块的改动"这一步操作不了,会有上面我提到的问题。或者说"提交子模块的改动"姿势不正确吗 |
Beta Was this translation helpful? Give feedback.
-
首先,确认子模块已经没有未提交的改动。你说的“"再到主仓库里提交对子模块的改动"这一步操作不了”是什么意思呢? |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
所以你的问题是无法更新子仓库,对吧?
你先试一下吧。 |
Beta Was this translation helpful? Give feedback.
-
我的问题的确是无法更新子仓库。但是有几个疑问 另外,回答你提到的疑问"你是因为在 detached 状态下做了提交,所以强制切换分支时被提示会丢弃提交吗?" |
Beta Was this translation helpful? Give feedback.
-
你看下make prebuild的处理脚本,里面有一行 git submodule update --init |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
git submodule update --init 会拉取当前已经commit到主仓库的submodule的。 |
Beta Was this translation helpful? Give feedback.
-
这个就是在主仓库里修改子模块的当前commit,然后提交主仓库里的子模块变更。 |
Beta Was this translation helpful? Give feedback.
-
假如submodule init之后子仓库的detached状态是正常的,那么把子仓库的变更拉到主仓库并提交的正确操作方式是怎样的呢 |
Beta Was this translation helpful? Give feedback.
-
你修改子模块之后,去主仓库里git status看一下。 |
Beta Was this translation helpful? Give feedback.
-
这些都是标准的git操作,不是higress特有的。。。 |
Beta Was this translation helpful? Give feedback.
-
感谢。更新代码应该使用update --remote |
Beta Was this translation helpful? Give feedback.
git submodule update --init 会拉取当前已经commit到主仓库的submodule的。
你如果修改了submodule里的仓库路径,比如改到了你自己fork的分支,那么修改后需要执行 git submodule update --remote,然后将当前对submodule的修改commit 提交,之后再执行 make prebuild。