首页 > 解决方案 > 如何将 github 子模块分支“A”中的更改拉入父模块分支“B”

问题描述

我在存储库 A 中进行了一些更改,这些更改反映在分支 A 中。此存储库 A 是存储库 B 的子模块。我想在存储库 B 的分支 Y 中反映存储库 A 的分支 A 更改。我该怎么做?

标签: githubgit-branchgit-submodules

解决方案


让我们X成为 submodule 的一个分支,AY成为 parent repository 的一个分支B

切换到X并更改目录到B. 运行git status会显示如下内容:

On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   A (new commits)

no changes added to commit (use "git add" and/or "git commit -a")

然后切换到Y并提交更改:

git switch Y
git add A
git commit

推荐阅读