Goal: keep a clean history of master, whilst also keeping the intermediary commits.
For instance, let's start with a master branch:
M1 --- M2 --- M3
^
master
I work on a feature/bug/whatever on a new branch:
M1 --- M2 --- M3
^ \
| \- F1 --- F2 -- F3
| ^
master feature
And when I merge into master, I want M3
to be the parent, but also keep the "iterations" you took to reach from M3
to the new commit. This can be done with merge --no-ff
:
M1 --- M2 --- M3 ----------------------- M4
\ / ^
\- F1 --- F2 -- F3-/ master
^
feature
Which is almost what I had in mind. The problem I have is that for git, as far as I can tell, both M3
and F3
are "equal" parents of M4
, now both part of branch master
.
What I want is to be able the show (with git log
) the master branch without the feature branch (F1-F3
) to have a cleaner view over the branch. ideally this would be default. But also be able to show the F1
F3
commits to view the more "detailed" history when needed.
Is there a way to have this, or something close to this in git
?