Last weeks I worked with Vibbo‘s Android team. Changing from one team to another one is great to learn new things. You know everything about moving outside of the comfort zone so I will not talk about it… :·)
This article tries to list all the times that git rebase broke my heart. I know that there’s a hot conversation about merging from develop to your branch or rebasing on develop. I always merged to fix conflicts, and some members of the Vibbo crew asked me to rebase over merge, so I went forward with rebasing. In addition, I tried to spread the word to another team… and well, I regret it.
The broken heart facts:
– When you rebase on another branch, you are requested to resolve every conflict it happened, commit by commit. So, if the branches are not too small, you will be asked several times. If you resolve conflicts on ten different files, it’s ok. But, if you have to resolve conflicts ten times in the same file… madness.
– If you missed a conflict and you screwed the whole code (’cause you are not perfect, my friend), you don’t have a “merge commit” where you can find your mistake. You have rebased. No merge commit. Good luck!
– Push force will be your new friend but HEY. git push origin –force pushes your branch to origin, right? Well, yes, but only partially. In Windows (at least, the version I had) it pushes ALL your branches. So, if you had an old version of develop, you will push it and screw all your friends. There’s a –force-with-lease version in the latest versions of git but hey, it’s not the standard –force.
– The Pull Request conversation gets disordered. A common Pull Request seems a Twitter timeline. Two commits, one comment, one commit, three comments. Then, you push force your just rebased branch, and all the messages are moved to the start of the conversation and all the comments after them. Goodbye, timeline!
Conclusion: if you are alone in a project or you work with a very committed team that loves living at risk, rebase could be a good option for you. But if you are in a real-world, you are an average git user or you work with average git users… don’t rebase.