r/programming • • Jun 19 '15

GitFlow considered harmful

http://endoflineblog.com/gitflow-considered-harmful
13 Upvotes

244 comments sorted by

View all comments

67

u/juliob Jun 19 '15 edited Jun 19 '15

if you use something like Gerrit to manage your Git repositories (which I recommend

Fuck. That.

Gerrit is a pain to use. It takes the normal flow of Git and breaks it completely. It takes the feature Git made easy to use -- branches -- and completely ignores it. It turns branches with several commits into commits that keep absolutely no history ("Why would I describe something when there is only a single commit message.").

So far, no one managed to explain to me, in convincing terms, what Gerrit is trying to solve. The only thing I can see is "when I merge, it floods the target branch with commits", which isn't actually a problem if you do a "--squash". One "manager" here tried to explain that they switched to Gerrit to get rid of a project that had 1000s branches. Really? I don't think he realized they just changed the problem of dealing with 1000s branches to a problem of dealing with 1000s commits not merged. So it turned a tool that there is plenty documentation, there is a very well known flow into something that reduces Git into SVN.

You can't directly merge with Gerrit. You need to pick the base commit/branch (if it's "develop") and cherry pick your commit on top of it; you need a special hook around otherwise Gerrit won't work properly. Reverting changes creates a new "branch" (commit), even if you're still dealing with the same "subject".

Gerrit is even more harmful than GitFlow. You lose all the knowledge your team already has about the tool -- and general version control flow --, you lose all the history you had during development due having a single commit for everything in that "branch", and you have to train everybody to use a tool in a non-standard way in which all available documentation about it is invalid.

39

u/1_800_UNICORN Jun 19 '15

Gerrit is the worst, and I'm surprised that someone who cares about Git history would bring it up.

Gerrit encourages you to make giant commits (since each commit becomes a separate code review), and if you have Gerrit tied to your CI and it fails for some reason, or your code reviewer asks you to make changes, new updates are supposed to be amended to the old commit, so the history of what you changed is lost.

6

u/[deleted] Jun 19 '15

Gerrit encourages you to make giant commits (since each commit becomes a separate code review), and if you have Gerrit tied to your CI and it fails for some reason, or your code reviewer asks you to make changes, new updates are supposed to be amended to the old commit, so the history of what you changed is lost.

Phabricator does the same thing, its retarded

3

u/theinternn Jun 19 '15

No, phabricator amends your new commit to the existing differential; differential still has copies of all commits made. arc land will squash your entire feature after it's been approved.

The only history lost in git is the history of how you completed the feature, which frankly no one cares about; people care about what changes went into master (IE got deployed) and the changes of the feature.

Historically, if you really need to see the mistakes or discussion of the feature, you can always get linked back to the differential which has the full history.

Note here: https://reviews.freebsd.org/D2850

If you scroll down to Revision Update History, you can see there's two diffs attached to this differential. This is the unuseful history lost by git, but saved by phab.

1

u/[deleted] Jun 19 '15

Its only unuseful if you don't spend time separating your feature into multiple commit

1

u/theinternn Jun 19 '15

If it's a multi step project, then associate multiple differentials with a task: https://secure.phabricator.com/T4209

1

u/[deleted] Jun 19 '15

This is incredibly annoying to do and there is no way to update all diffs at once

1

u/theinternn Jun 19 '15

The only thing you need to do to attach your diff to your task is add the task number in the commit message

1

u/[deleted] Jun 19 '15

I mean update all diffs to new changes. Usually they depend on each other