How to modify a root commit affecting all the branches derived from it

I want to modify a previous commit and I wonder if there is the possibility to propagate this change to all the branches that derive from that commit.

So basically I have a situation like the following

A – B – C – D (master)
    \
     F (branch)

what I want to do is to edit a previous commit, in particular C into C’
The command I run from master is:

git rebase @~2 -i

and I choose “edit” to C commit
I do my changes and I commit them. The result looks like this:

A – B – C’ – D (master)
   \
    C – F (branch)

while actually what I would like to have is to change C into C’ for all the branches, thus having something like this:

A – B – C’ – D (master)
    \
     F (branch)

Hi @torto85 :wave:

There are several ways of rewriting your commit history. Take a look at this article on amending commits.