I work in a small team of 5 developers. We are trying to figure out how to keep our development branch as clean and less polluted as possible. Until now, we have been doing this flow:
The problem is that this usualy cause to create a new "merge...onto dev" commit, and create the diamond shape which is kinda confusing, even with only 5 developers.
Is there any better flow, maybe using rebase, to keep the develop branch cleaner and as straight as possible ?
Best regards
TL;DR :
git pull --rebase
or git rebase
)So to get into details.
When I passed from svn to git, I was shocked by the graph log complexity, it seemed awful to read after using the flat svn history during years. But graph is an integral part of git and the complexity in the log came with.
To answer your question, I think you need to continue the merging of your feature branches on develop cause it brings sense to your history:
Concerning the rebase you absolutely have to avoid doing it on public/shared branches. Cause it's often rewriting your history, the risk of losing information is high and your distant repository will quickly be out of sync with your mate's repositories. If you need to do a git push --force
on a shared branch, you are in a danger area.
I could preconise you to do rebase only to update your local branch with the distant repository. If you don't, updates will indeed create useless merge commits that will make your history dirty.
So, update your branches only with git pull --rebase
and get your feature back with a old classical git merge.
An updated flow will be :
With some practice, you will get more comfortable with the "diamond shape".
I personally use a gup alias which is git pull --rebase
to force me to use rebase on every update I do.
Hope it helps.
Julien.