I have a branch like this A->B
I mistakenly added an extra string to the original string Foo
and it became Fooo
in commit A.
And I remove the o
in commit B. (i.e. Fooo -> Foo
)
The purpose of both A
& B
are just adding new files so I want to eliminate all the confusing changes on Foo
After removing extra o
at commit A
, I git commit --amend and get a new commit A'
Now I want to make the branch like this: A'->B'
Here is the step:
git checkout B
git rebase -i A'
A file shows and lets me to edit, such as something like : pick:B
, I don't change anything.
I expect that I could edit the conflict, but after git rebase --continue
the rebase finished immediately.
Finally I get a stupid result A'->A''->B'
.
The commit A''
add the extra o
I removed at A'
, then the B'
removed it again.
How can I do to eliminate all the confusing changes on Foo
?
I figure out how to do it simply.
The content of file shows after rebase is:
pick:A
pick:B
After removing the line pick:A
, than I rebase it smoothly.
I think the solution for squash A'' & B' also works.
Thanks for helping.