As mkrieger1 said, you literally just want to create the label b3
pointing to commit C
.
The trick with GitHub and GitHub's "PR"s (pull requests) is that now that you have these names locally, you need to create the same names on GitHub—remember that their repository is in fact a separate, independent repository, with its own independent branch names—pointing to the same hash IDs. That part is easy enough: just git push origin b3
with name b3
identifying commit C
locally. Since commit C
(with that same hash ID) is already copied to GitHub, this just creates the name b3
on GitHub, pointing to commit C
. And, that now means that on GitHub, you can create a pull request that says let's merge commit E into commit C, using names b3
as the PR and b2
as the "base branch". GitHub can only see their own names in their own repositories, but now that you did the git push
, they have the same names you do.
Note that if and when the PR is approved and commit E
gets merged into commit C
on GitHub, this can:
- be a true merge, or
- be a "rebase-and-merge", or
- be a "squash-and-merge"
but under no circumstances will the big green "merge" button on the GitHub web page create a fast-forward merge. This means you will get:
master b3
↓ ↓
A -- B -- C ------ M
\ /
D -- E
↑
b2
if you select the "true merge" option, or:
master b3
↓ ↓
A -- B -- C ---- D' -- E'
\
D -- E
↑
b2
if you select the rebase-and-merge option, or:
master b3
↓ ↓
A -- B -- C ---- DE
\
D -- E
↑
b2
if you select the "squash and merge" option.
If none of those options are acceptable (for whatever reasons—they'd be your reasons since at least some of these should work in at least some circumstances), do not use the big green merge button on the GitHub web pages.