, master master, - , , , , ,
, , , (git rebase -i) , ( , [M2]).
( ):
[F1]-[F2]-[F3] -- Feature Branch
/ \
[M1]-[M2]-[F1]-[M3]-[M4] -- Master Branch
, :
pick hash_f1 [F1]
pick hash_m3 [M3]
pick hash_m4 [M4]
, [F2] [F3], [F1] . , [F1], .
:
[F1]-[F2]-[F3] -- Feature Branch
/
[M1]-[M2]-[M3]-[M4] -- Master Branch
master M , feature F , [M2]. , :
git merge --no-ff feature
- , :
[F1]-[F2]-[F3] -- Feature Branch
/ \
[M1]-[M2]-[M3]-[M4]-[F*] -- Master Branch
, , , . , .
In addition, this process can be extended to any links, and not just to the function and main branch, so there are other cases where this may make more sense. In my opinion, a stable branch such as master should not usually rewrite its history, but each Git environment and workflow are different, so there are really no rules that cannot be rewritten.