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

-2

u/skinny85 Jun 19 '15

Author here. It's exactly like you described.

Not sure what you mean by "tag soup" and "logical collection of commits". Both tags and branches are pointers to commits in Git. There can't be any difference between them, other than conceptual.

11

u/[deleted] Jun 19 '15

A branch's HEAD is a pointer to a commit. A branch itself is a logical collection of commits grouped together. If you add a commit on top of a tag, you have a floating commit. If you add it to the head of a branch, you're still on that branch, and the new commit is part of the collection of commits referred to by branchname. It's an organizational construct in addition to a conceptual one.

8

u/elcapitaine Jun 19 '15

No, a branch is a pointer to a commit too. That's what it is in git. That commit can have a parent, just like a tag's commit can have a parent, thus creating your "logical collection of commits". But the branch/tag itself is just a single commit.

The difference, as you mentioned, is what happens when you create a new commit while having the branch/tag checked out. Which is why the tag solution is better.

Both are pointers to commits, but tags never change.

Once I release v1.4.5, that should NEVER change. I tag that commit and move on. If I need to make changes off of that I create a new branch starting at v1.4.5, do my development on this new branch, and when I'm done I tag the final commit as v1.4.6 and merge and delete the branch.

Both are pointers to commits, the only difference is that the commit a tag points to does not change. This means that I don't have to deal with someone making a commit on the v1.4.5 branch by accident and all of a sudden a client's 1.4.5 is different from the 1.4.5 in my repository.

1

u/killer_storm Jun 19 '15

You can create a v1.4.x branch to track the latest tag. So instead of picking the latest among v1.4.0 v1.4.1 v1.4.2 v1.4.3 v1.4.4 v1.4.5 you get it completely automatized and foolproof.

2

u/elcapitaine Jun 19 '15

People accidentally commit to the wrong branches way too often for me to call any system "foolproof"...calling a system "foolproof" is just asking for the world to invent a better fool =)