I have two branch: main
and develop
. develop
is behind main
by 1 commit.
So main
has 3 commits:
C1 - C2 - C3
I created develop
branch when main
was at C2
. Now I made a series of commits in develop
and later rebased main
into develop
running the command git rebase main
. Comparing with main
, the commit graph for develop
looks like the following,
main: C1 - C2 - C3
develop: C1 - C2 - C4 - C5 - C3
Now, how do I fix develop
to have the commit history as follows:
C1 - C2 - C3 - C4 - C5
CodePudding user response:
It's hard to be certain, as your diagram is incoherent, but it sounds like what you mean might be
git switch develop
git reset --hard @^1
git rebase main
That will give
C1 - C2 - C3 (main)
\
- C4 - C5 (develop)