I have 3 branches
- feature
A(not managed by me) - feature
B(managed by me) - branch
main
My B branch is dependant from the branch A and A is already squashed in the main branch.
This graph shows the curret situation.
I want to move (rebase) B on the comment corresponding to Squashed A.
I used the command git checkout B && git rebase main to rebase it but I have a lot of conflicts to manage and is not so easy to avoid problems or bugs.
I have find out This post but I have an already squashed branch (not Squashed by me).
How can I have this result with few commands without having so much throubles with few ?


The question you linked actually contains the answer to your question:
This should give you exact same content as
Bbefore the operations.You can double check by creating a tag before doing anything and using
git diff <tag-before-ops> Bafter the operations.Important: as suggested by @eftshift0, this is assuming that
Ahas not changed and still is in the state before squashing.If that's not the case, you may use any ref pointing to the state of
Abefore squashing likeB~2in this very example or the commit hash directly.