Let's say I have
main - 1 - 2 - 3 (A)
\
4 - 5 - 6 (B)
The remote repo's manager wants to merge A
to main
(ff) first, then merge B
to main
. Thus, he wants me to merge A
into B
first so there won't be issues later on:
(A)
main - 1 - 2 - 3
\ \
4 - 5 - 6 - 7 (B)
(A)
0 - 1 - 2 - 3
\ \
4 - 5 - 6 - 7 (B, main)
(an 8th commit isn't needed, right? Just ff main
twice?)
My question is: would I get the exact same result (including git history or any other factors I don't know about) if I did this instead:
(I'll explain why I want to later on)
Create a copy of A
, A'
, then merge B
into A'
,
(A)
main - 1 - 2 - 3 - 7 (A')
\ /
4 - 5 ----- 6
(B)
Then fast-forward B
into A'
, deleting A'
after,
(A)
main - 1 - 2 - 3 - 7 (B)
\ /
4 - 5 ----- 6
Finally ff main
.
(A)
0 - 1 - 2 - 3 - 7 (B, main)
\ /
4 - 5 ----- 6
Are there any reasons to avoid my second method?
Why I want to do this:
B
contains some wrong changes from main
that I don't want/is wrong. I don't remember what those changes are. If I merge A
into B
, these changes would still be there.
Therefore, I would like to manually vet through all changes made by B
.
I could do an interactive rebase, but B
has many commits. I don't want to go through all of them, and I also don't remember which commits introduced the wrong changes. Also, A
made some renames that affected many files, which would cause conflicts I'd have to fix on every commit.
I also saw a three-way merge tool as option but I've never used that before and found this way easier.
Merging B
into A'
instead of A
into B
puts all the changes B
has with respect to A
in the working tree, allowing me to vet through all of them at once.