在GIT中,我有两个分支和两个提交:
A(master)---B(branch "topic")
Run Code Online (Sandbox Code Playgroud)
我想在"topic"分支中创建一个合并提交C(它将A和B作为父级).(我知道这看起来很奇怪,并且合并提交将为空.)
A(master)---B---C (branch "topic")
\-------------/
Run Code Online (Sandbox Code Playgroud)
我设法以太复杂的方式创建这个合并提交(见下文).有没有更简单的方法来创建此合并提交?
谢谢你的回答!
初始状态:
$ git init plop
Initialized empty Git repository in /tmp/plop/.git/
$ cd plop/
$ git commit -m "Initial commit (commit A)" --allow-empty
[master (root-commit) a687d4e] Initial commit (commit A)
$ git checkout -b topic
Switched to a new branch 'topic'
$ git commit -m "Some work on my topic branch (commit B)" --allow-empty
[topic d4d1c71] Some work on my topic branch (commit B)
$ #OK, …Run Code Online (Sandbox Code Playgroud)