如何将更改从 github 子模块分支 "A" 拉入父模块分支 "B"

How to pull changes from github submodule branch "A" into parent module branch "B"

我在存储库 A 中做了一些更改,这些更改反映在分支 A 中。此存储库 A 是存储库 B 的子模块。我想反映存储库 A 的分支 A 在存储库 B 的分支 Y 中的更改。我如何这样做?

X 为子模块 A 的分支,Y 为父存储库 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