r/programming • • Jun 19 '15

GitFlow considered harmful

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

244 comments sorted by

View all comments

Show parent comments

4

u/[deleted] Jun 19 '15

Yep, I understand what it does technically.

rebase appears to destroy history, so I don't like it.

Pretty sure you don't understand what it does.

Also, this has nothing to do with quality of the software itself, or quality of the code base, but rather, quality of development efforts. When you want to get ahold of the guy responsible for changing a line of code, git blame is useful, until merge commits come into play, and your name is plastered over someone elses code because they were working at the same time as you on something unrelated to you.

I'd rather just have a clear and correct history, than have a bunch of nonsense that makes history more difficult to read and understand

1

u/Netzapper Jun 19 '15

Pretty sure you don't understand what it does.

Apparently not. Although I just re-read the documentation.

Is there an article on using rebase that isn't focused on aesthetics?

If I already have a code review process, a change request process, and requirements documents electronically signed by each dev as he completes the requirement (all of which is required of me by law)... what facilities does rebase provide me, other than give my guys another opportunity to fuck up the central repo?

If rebase doesn't provide features or utility, only fiddles the aesthetics, this is just another tabs-vs-spaces debate. You like it your way because you're used to it. I like it my way because it's what I'm used to.

2

u/[deleted] Jun 19 '15

Wow, i wonder who wrote this line of code, i'll just git blame it

Ohh, Netzapper wrote it, let me talk to him.

VS.

Ohh, I wonder who wrote this line of code, I'll just git blame it, then grep the log to verify it's not a merge commit, if it is, git show the commit, find the parent commits and see which one is to blame for this line of code, then contact Netzapper since he wrote it.

What couldn't be simpler?!

1

u/Netzapper Jun 19 '15

Oh! In my shop that goes like:

"Wow, I wonder who is responsible for this line of code?" I'll query the requirements database to see which engineer last signed off on this module. Oh, it's giveupitscrazy... well, regardless of whether or not he wrote the code, he owns that module and reviewed it, so he's who I'll call. If he signed off on somebody else's code, it's okay, because he must understand it, or he wouldn't have signed off on it.

1

u/[deleted] Jun 19 '15

so you basically recreated git blame to work around the faults of git merge then wonder why people use git rebase, it now makes perfect sense, your comment was completely out of ignorance.

1

u/Netzapper Jun 19 '15

so you basically recreated git blame to work around the faults of git merge then wonder why people use git rebase

Nooo... I "recreated git blame" [sic.] to satisfy the FDA. I'm extremely suspicious of rebase because I'm concerned the FDA will consider that tampering with the audit trail.

your comment was completely out of ignorance.

That is true. I've used git for years, with a variety of workflows and teams (in games and medical devices), and I've never seen any need for rebase. The arguments I've always heard were related more to aesthetics than utility.

You've demonstrated that it does have some utility. It just seems like not much gain at all, given how many people fuck up the rebase merge.

1

u/[deleted] Jun 19 '15

interesting. I also work with a government organization, AFAIK they don't care so much about our history as they do about what actual code changes we make.

Granted, it's a completely different line than FDA, but you'd think they would all adhere to some similar practices.

1

u/Netzapper Jun 19 '15

AFAIK they don't care so much about our history as they do about what actual code changes we make.

That's where I'm coming from. Aside from rolling back a fairly fresh commit, or bisecting a bug so that we can fix it in next release, I've never seen anybody go back in time with git or any other version control. Ever. Who cares how tangled your branch graph looks on github?

But we use git history to prove that no 3rd party has interfered with the code, that the code we're working on and documented is the code we've built, and that the artifacts we've built are the ones we've shipped. When we freeze versions for release, we have to support that version. So we branch on release, and fixes are manually backported, because each release is more or less a separate medical device. Think Version 2 of your hip prosthetic; shouldn't that be scrutinized with a similar process as Version 1?

If my guys wants to use rebase locally to squash commits before pushing them, and nobody knows it's happening... meh, whatever. But rebasing out merge commits makes me uneasy.

0

u/pipocaQuemada Jun 19 '15

When you want to get ahold of the guy responsible for changing a line of code, git blame is useful, until merge commits come into play, and your name is plastered over someone elses code because they were working at the same time as you on something unrelated to you.

This seems to suggest that rebasing is useful as a workaround for bad tools (e.g. blame fingering a merge as the issue instead of the actual original commit). Why not just fix blame and the other bad tools?

In Mercurial, at least, blame works sensibly.

2

u/[deleted] Jun 19 '15

it's more about the right tool for the right job.

understand how to use the tool, and you'll see that both rebase and merge work together for two separate things. It's when people ignore a step or use merge for more than one thing does stuff break.

1

u/pipocaQuemada Jun 19 '15

it's more about the right tool for the right job.

What job is rebase for, and what job is merge for, then?

The last company I worked at used mercurial with a purely merge-based workflow, and it worked out beautifully.

I've heard some people say that they do a lot of small, short-lived 'micro commits' that don't compile that they don't want to present to their team-mates and clutter up the log. This, too, seems like bad tooling/an incomplete model to me since you should be able to do this by just including some metadata on the commit describing what type of commit it is, and then filter your log by that.

1

u/[deleted] Jun 19 '15

Rebase

When you want to bring in other peoples changes into your local branch

Merge When you want to merge your changes into a main branch(ie master), or merge one main branch to another(develop to master).

EDIT: This is a workflow that describes the use of rebase and merge.

1

u/pipocaQuemada Jun 19 '15

Why not just merge other people's changes into your local branch?

1

u/[deleted] Jun 19 '15

going in circles now.

Merging other peoples changes into your local branch causes merge commits, which dilutes the commit history and puts your name on someone elses code.

While OP's article here had quite the click bait title, and i didn't agree with much he said, he makes an excellent case for what merge commits will do to your repository.

At the end of the day, a branch should be made, code written, then rebased and merged in with out much thought about that branches long term history, so you really should see a linear progression of code change, not a giant sideways graph showing who happened to write what when.

Also consider that, it's less important when a particular line of code was actually written over the span of 2-3 days, and more important when that code landed in a main code branch(ie master). merging preserves those old pointless dates at the cost of losing who's name belongs on a line of code.

And finally, what's in a merge commit is almost entirely arbitrary.

Let's take 3 programmers on a much larger team(10+, Joe John and Jack.

Joe pulled monday afternoon, and started a new feature, John pulled wednesday morning and started a new feature, and Jack pulled today and started a feature.

Jack commits his code first, but worked quickly enough that noone else had pushed anything. No merge commit happens, why would it? he added something to the latest copy of code.

John commits next, his commit includes code written since wednesday. Most likely this code has already been deployed, other people have blamed and found the real author, but because John didn't rebase, he now has his name slapped on some random files he didn't touch that were written by someone else

And finally Joe, he started on monday, but he rebased his work. So even though he committed 15 times in his branch throughout the week, those 15 commits are applied as if they happened just a moment ago, to the latest copy of the master branch. He pushes, and no merge commit happens. He doesn't have his name slapped on some changes from monday that another developer made.

Merge just makes it harder to deal with other developers, while rebase lets developers work together.

1

u/pipocaQuemada Jun 19 '15

Merging other peoples changes into your local branch causes merge commits, which dilutes the commit history and puts your name on someone elses code.

So in other words, you rebase because git's tooling is bad at handling code with merges so you want to avoid merging?

That doesn't sound like they're two different tools for two different purposes. If git's tooling were perfect and worked well with merges, would there ever be any reason to rebase?

0

u/[deleted] Jun 19 '15

how is it bad at handling merges? it does what it's designed to do:

take two separate branches and merge them.

Rebase does something different:

Applies changes from another branch and put them into the current one, then apply the local changes after.

They may accomplish the same task two different ways, but that doesn't inherently make one method flawed over another. And you wouldn't use rebase to bring in your feature branch into master either, you would use merge.

All it really sounds like, is whatever tool you use is hiding two features under one name, and letting you sit in the dark about it, while you go and blame git's tooling because of your lack of understanding of source control.

2

u/pipocaQuemada Jun 19 '15

how is it bad at handling merges?

It's not bad at the process of merging two commits. It's bad at handing history that's merged based. For example, git log produces an ugly log, git blame fingers the wrong merge as being the source, and git bisect doesn't handle merges well.

They may accomplish the same task two different ways

Exactly. At the end of a rebase or a merge, your working directory remains the same. The only difference is the way that history is recorded: did you record the actual history (with merges), or rewrite it into a just-so story (by rebasing)?

All it really sounds like, is whatever tool you use is hiding two features under one name, and letting you sit in the dark about it, while you go and blame git's tooling because of your lack of understanding of source control.

No. There is one feature here (i.e. merging commits), and it has one name - merging. Mercurial does have rebase as an extension. It doesn't occasionally rebase when you tell it to merge. It just has tools that work well enough with a highly branching merge-oriented history so the only reason to rebase is if you're a 'clean history' fanatic who finds DAGs to be morally repugnant.

→ More replies (0)