News for hackers. Stuff that matters.
Re:A development process to ship features fast by JimmieMcnulty on Tuesday September 13, 2022 @03:57AM (#32821691)
This is written as if git doesn’t exist, and Agile were never invented.

If branching/merging is giving you this much trouble, you’re doing something very, very wrong.

Pause, actually learn git, then resume.

Also, testing is so easy, if you’re doubling your dev time writing tests, that’s another thing you need to dedicate time to for learning, because it should add maybe 10% more if you’re competent.

Re:A development process to ship features fast by gocartStatue on Tuesday September 13, 2022 @04:20AM (#32821835)
Git does not solve the issue of accidental complexity introduced by branching. Since we are exchanging arbitrary statements: If you need branches outside the realm of libraries with multiple supported versions, you're doing something very, very wrong. "Feature branching is a poor man's modular architecture". And I'm pretty confident about my git-fu.

Agree on the testing, though, unless you're doing horrible generated cruds it is usually faster to write tests than not.

Re:A development process to ship features fast by JimmieMcnulty on Tuesday September 13, 2022 @08:20AM (#32823351)
Git completely removes the complexity introduced by branching, as it takes care of merging the branch for you?

It honestly sounds like you don’t know what a branch is, since you’re talking about libraries and multiple supported branches, so I very much doubt your “git-fu”.

It sounds like you’re in the “merge conflicts are hard” camp, which is a camp of ignorance.

Re:A development process to ship features fast by gocartStatue on Tuesday September 13, 2022 @09:51AM (#32824278)
I’m in a „merge conflicts are a waste” camp. I don’t need multiple parallel versions of software (unless it’s a library following semver). I need to hear a single good reason for not applying changes incrementally to main branch multiple times a day.
Re:A development process to ship features fast by JimmieMcnulty on Tuesday September 13, 2022 @11:10AM (#32825312)
Coworkers.

Also you’re pushing code into this main branch from… where? Another main branch.

That’s literally how git works, you’re just removing any oversight and collaboration opportunities by insisting on calling this branch you’ve created locally “main” as well.

Code reviews are awesome, and not doing them is a fantastic way to ruin your team’s ability to support work they didn’t themselves write.

Re:A development process to ship features fast by gocartStatue on Tuesday September 13, 2022 @12:58PM (#32826980)
Does it have to be post-coding, pre-merge code review?

The difference lies in size of the diff and the manner of introducing changes. Other developers have your changes instantly. This is core of the discipline called „continuous integration”.

I’ve been in multiple teams doing mandatory, pre-merge, double code reviews and getting crappy results. The longer someone kept their precious feature branch isolated, the worse.

And keeping branches „up to date” only solves a small part of the problem with long lived branches.

Re:A development process to ship features fast by JimmieMcnulty on Tuesday September 13, 2022 @01:04PM (#32827074)
Yeah, but nobody here is suggesting long lived branches, nothing about a feature branch requires that it exist for a “long time”. Your local “main” branch that you’re developing a feature against is a “feature branch” you just aren’t calling it that.

But even if it did, regularly remerging main back into it (or rebasing) does solve like 90% of the issues being described here, and further comes with a whole host of other benefits.

Re:A development process to ship features fast by WHATDOESIT on Tuesday September 13, 2022 @04:07AM (#32821749)
How does learning Git solve the problem that the other team members changed the code so much I have to rewrite half my work again? Happens especially in agile environments - waterfall is planned upfront so usually you don't change what you already did.
Re:A development process to ship features fast by Xylakant on Tuesday September 13, 2022 @04:09AM (#32821759)
How does any tool help if your colleagues don’t talk to you? Or you don’t talk to your colleagues?
Re:A development process to ship features fast by WHATDOESIT on Tuesday September 13, 2022 @04:10AM (#32821767)
Well if I commit my changes ASAP to the main branch, there's much less/zero divergence at any given time. This is not about talking - I and the other teammates might be perfectly aware of it happening and still - we are agile so their work has to be done immediately, mine too, the problem with feature branches remains.

I actually tried to simply have my team commit to the main branch, and it worked out quite well - we never had problems with code divergence. I guess it doesn't work so well for larger teams not working on MVPs, though (we were 5 developers).

Re:A development process to ship features fast by Xylakant on Tuesday September 13, 2022 @04:24AM (#32821854)
Every time you have a local working copy, you essentially have a feature branch. Their local modifications and your local modifications can be incompatible - pushing to the same branch only moves the problem to “who pushed first”. At least with separate branches, you can observe their changes and pull them in at a suitable time.
Re:A development process to ship features fast by WHATDOESIT on Tuesday September 13, 2022 @04:35AM (#32821911)
My aforementioned MVP team solved this issue with commiting/pushing and pulling frequently - and a tiny little bit of communication about what we do during the daily standups. We never had too much problems after we got the hang of it. The problem with feature branches is that if there are more than 2 people working on the same place in the code base, it's very hard to synchronize it all without having a common branch, even if all the people are communicating 24/7.
Re:A development process to ship features fast by gocartStatue on Tuesday September 13, 2022 @04:36AM (#32821917)
You have a short-lived local branch tracking remote main branch, not a feature branch. It works if you `pull --rebase` and never force-push (which is trivial to enforce in the origin repo). That DOES require working in very small increments which is good unless maybe when you're doing highly experimental work that you may discard. In this case a branch might actually be a great idea.
Re:A development process to ship features fast by Xylakant on Tuesday September 13, 2022 @05:13AM (#32822091)
You can do exactly the same with a feature branch on the remote side. This is not a replacement for actually communicating around what work you do.
Re:A development process to ship features fast by WHATDOESIT on Tuesday September 13, 2022 @05:18AM (#32822112)
Have you tried synchronizing three disparate feature branches this way? I don't think it's really possible. We had a very bad experience trying to do that.

The thing is, I want my developers to code, not talk all the time about what/where they would like to code and that the others have to wait until they're finished or suck up the merge conflicts if there's no time. Some communication is always necessary - but this solution with feature branches requires constant communication and still, the developers would rather wait that try to synchronize this way.

Re:A development process to ship features fast by JimmieMcnulty on Tuesday September 13, 2022 @11:57AM (#32825999)
What? It’s trivial to keep these branches in sync…

The more you comment, the more it’s clear you work with a bunch of coders who want to “go dark”, and there are a ton of problems with that.

Don’t go dark.

Re:A development process to ship features fast by WHATDOESIT on Tuesday September 13, 2022 @01:50PM (#32827842)
Nobody wanted to go dark :-D each of us was an unpaid co-founder. Going dark looks very different from what was happening there - each of these guys just wanted to ship code so we make money, ASAP.

Well it wasn't trivial at that stage of our development. It became much more trivial once we and the market were happy with our product-market fit and at that point we indeed started with feature branches again.

Now I'm working at a consultancy and since there's much more time for everything, we are doing feature branches during our MVP development too. But there's a stark difference in velocity this current team and the team I told you about achieved.

Re:A development process to ship features fast by JimmieMcnulty on Tuesday September 13, 2022 @03:00PM (#32828769)
You're not using the correct terminology to describe what you were doing...
Re:A development process to ship features fast by JimmieMcnulty on Tuesday September 13, 2022 @08:15AM (#32823306)
I’ve been using git for nearly 15 years and not more than a half dozen times has resolving a merge conflict taken me more than 15 minutes.

This just isn’t a real problem. Try working more incrementally, or try working with colleagues who don’t rewrite large swaths of code without coordinating with their team.

You have a people problem, not a tool problem.

Re:A development process to ship features fast by WHATDOESIT on Tuesday September 13, 2022 @10:02AM (#32824413)
We're in agreement - what I said is basically that learning to use the tool better doesn't help, and what helped was to do exactly what you said, make smaller increments and integrate them frequently. Ad not rewriting large swaths - that's more of a product management issue and was outside our control. It wasn't all bad too - we were simply searching for that product-market fit.
Re:A development process to ship features fast by JimmieMcnulty on Tuesday September 13, 2022 @12:09PM (#32826188)
Learning to use the tool absolutely does help, because it alters your workflow to fix your glaring developer experience issues.

Your team is suffering badly from a lack of even a baseline understanding of how to develop software as a group, and learning even the most basic usage of git would substantially alleviate that issue.

Re:A development process to ship features fast by WHATDOESIT on Tuesday September 13, 2022 @12:26PM (#32826450)
Our team was suffering from a somewhat unusual business situation, but that's about it. I don't think any of us could've learned something truly new about Git (well except me, maybe - but I was not writing too much code anyways).

When your business changes wildly every 2-3 months for a year (and sometimes few times a month too), it's hard to not change the code base a lot. Our place was not to change this situation - our place was to learn to deal with it, which we did satisfyingly.

Re:A development process to ship features fast by JimmieMcnulty on Tuesday September 13, 2022 @12:41PM (#32826697)
You’re literally doing feature branches, you’re just doing it worse by not changing the names of the branch as you have it locally (so you can’t share or store your work anywhere but on your machine), but you don’t know enough about git to speak intelligently with others to accurately describe your team’s workflow.

Also I guarantee I’ve used git branches in more dynamic situations than what you’ve described here and it caused absolutely zero issues.

Re:A development process to ship features fast by WHATDOESIT on Tuesday September 13, 2022 @01:00PM (#32827004)
Nah, we really were not doing feature branches. That would require us to branch out and then merge the branch once the feature is complete - that's what we did initially. Since that didn't work out for us, we committed and pushed basically any non-breaking piece of code, regardless of whether the feature was (ever) finished. A single feature could've been anywhere between 1-20 days of work (let's say 5 days average), but we committed - and pushed to main - roughly every few hours, so none of that "only on your machine" stuff you're talking about.

I'm glad that your preferred branching strategy works out well for you.

Re:A development process to ship features fast by JimmieMcnulty on Tuesday September 13, 2022 @01:10PM (#32827171)
My brother in Christ what is it you think you’re doing when you clone a repo?
Re:A development process to ship features fast by WHATDOESIT on Tuesday September 13, 2022 @01:14PM (#32827242)
Not feature branches :-) especially since each of us kept care to have their local copy up-to-date. It's hard to reuse others' code (from unfinished features) otherwise.

Seems like by your definition there's no way to not do feature branches. A little weird take, IMHO - I know it as a very specific strategy that you have to consciously perform e.g. by naming your branches correctly in sync with your issue tracking system, by not merging until you're done with that ticket, etc - not something that happens automatically just by cloning.

https://sillevl.gitbooks.io/git/content/collaboration/workfl...

Re:A development process to ship features fast by JimmieMcnulty on Tuesday September 13, 2022 @02:55PM (#32828695)
Your local copy is a feature branch, as you are developing features on a branch other than the branch you've designated as the "primary" branch (your "main" is a branch off of the main repo's "main").

There is nothing whatsoever that requires a feature branch be long lived or named anything in particular. This is what I mean when I say you don't understand the technology you're using.

What you have linked is a "flow" that uses branching, and isn't relevant to this discussion.

Re:A development process to ship features fast by WHATDOESIT on Tuesday September 13, 2022 @03:17PM (#32829001)
Well, terms have meanings and it's nice to keep it, makes discussion easier.

So yeah sure, we were doing 2 hours-long 1%-of-a-feature branches.

Re:A development process to ship features fast by JimmieMcnulty on Tuesday September 13, 2022 @03:20PM (#32829037)
It does make discussion easier, which is why your improper use of the term caused such confusion here, and illustrates my larger point; your team sounds like it has a fundamental lack of git knowledge which prevented it from successfully making use of the tool, instead falling into anti-patterns and bad habits that may or may not have resulted in delays, confusion, and disruption that would not have been necessary had you actually known the correct way to keep a branch up to date and avoid costly merge conflicts.
Re:A development process to ship features fast by WHATDOESIT on Tuesday September 13, 2022 @03:44PM (#32829301)
How come every single article I come across agrees with my definition?

https://www.atlassian.com/git/tutorials/comparing-workflows/...

https://www.decodingdevops.com/how-to-create-feature-branch-...

https://docs.gitlab.com/ee/topics/git/feature_branching.html

Could you please post at least one article which describes what you're talking about and what the differences from "just commit/push to main" are?

BTW this whole thing isn't about keeping a branch up to date with the main branch - sure that's easy. This is about integrating changes in a small code base where collisions happen often due to small but rapidly changing featureset on which 5 hyperactive developers work on. The only solution to that is to integrate the code very often on a common branch - in our case, around every 1-2 hours, regardless of features being done or not.

Re:A development process to ship features fast by JimmieMcnulty on Tuesday September 13, 2022 @04:43PM (#32829947)
What? You want an "article" that describes how git branching works? Here.[0].

> Some people refer to Git’s branching model as its “killer feature,” and it certainly sets Git apart in the VCS community. Why is it so special? The way Git branches is incredibly lightweight, making branching operations nearly instantaneous, and switching back and forth between branches generally just as fast. Unlike many other VCSs, Git encourages workflows that branch and merge often, even multiple times in a day. Understanding and mastering this feature gives you a powerful and unique tool and can entirely change the way that you develop.

It's really not hard, a "local copy" is a branch.

If you can't manage what you just described trivially, you need to learn git better, because I, and everyone else who knows how to use git, can manage those things trivially, and have successfully for many years now.

Your solution was the wrong one, homegrown to avoid dealing with the reality that you and your team didn't know how git works.

All of this would be fine, by the way, had you not proposed others listen to you. Exactly zero people should do as you have described.

[0] https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-N...

Re:A development process to ship features fast by WHATDOESIT on Tuesday September 13, 2022 @04:58PM (#32830100)
You can't really do feature branches without knowing how branching in Git works...

> It's really not hard, a "local copy" is a branch.

For sure. Not necessarily a "feature branch" though. That's a more specific thing described in the articles I linked, building on top of the basic Git feature you linked.

Re:A development process to ship features fast by JimmieMcnulty on Tuesday September 13, 2022 @05:00PM (#32830125)
I didn't say you could, I said your proposed "never use any branch other than main" was both factually incorrect (your team literally didn't do that) and not how the git tool was designed (merging branches into a main branch is trivial, and in fact how the tool was designed).
Re:A development process to ship features fast by WHATDOESIT on Tuesday September 13, 2022 @05:04PM (#32830155)
Sorry that I didn't explicitly say "local copy of the main branch". I thought that's a given. Not that it's really relevant though... Still the same problem with feature branches - if you don't integrate often the code will change under your hands and you won't be able to use the code others made until you integrate with them.

Please understand that "feature branch" is a technical term describing a very specific branching strategy - and you're not going to find its definition in the Git docs; I think it was originally defined by Atlassian (but not quite sure). A local copy of the main branch with a few additional commits that you're going to push to the origin way before the feature is complete is not a "feature branch" as commonly defined.

Re:A development process to ship features fast by JimmieMcnulty on Tuesday September 13, 2022 @05:47PM (#32830568)
You're claiming what your team did wasn't "develop features in a branch", when you did precisely that.
Re:A development process to ship features fast by WHATDOESIT on Wednesday September 14, 2022 @01:53AM (#32833729)
No, I am claiming "our team didn't develop features in feature branches". Local copy of the main branch is a branch too, I know that very well. But it's definitely not a "feature branch" - it's not named after the issue number, it's merged way before the feature is complete, no PR is created, etc.
Re:A development process to ship features fast by JimmieMcnulty on Wednesday September 14, 2022 @08:52AM (#32836456)
An irrelevant claim then, as the comment you originally replied to wasn’t about “feature branches”.

You originally replied talking about how hard branches are to merge, but then revealed you also use branches to develop features, thus revealing a fundamental lack of understanding about how git works.

Re:A development process to ship features fast by WHATDOESIT on Wednesday September 14, 2022 @09:34AM (#32836957)
Yeah indeed, I was the one to bring feature branches up - my original comment said that learning Git better won't help you with feature branches in case such as ours, and that what's actually needed is a workflow change - as a reply to a comment claiming that any issues could be solved by just learning the tool better, as if there was a magic command argument that'd resolve the merge conflicts resulting from this workflow, or something.

In our case we stopped using the `git branch` and `git checkout` commands whereas previously it was an integral part of our workflow, hence "not branching out" - again, sorry for not saying explicitly in that one comment that of course we worked with the local copy of the main branch which is a branch too, since that's how Git works I thought that's a given, this is a professional forum and I didn't think I need to call out everything so explicitly as if I was talking to a junior dev.

I never said that branches are hard to use nor that we didn't use them - it's only your strawman where you (since I explained what I meant so many times, it must be) intentionally misinterpret what I said about feature branches. You even sent a link to Git docs when I asked you about workflow strategy and in reply to articles talking about workflow... :-D

Feature branches are a very common workflow at many companies big and small, one could reasonably say it's the standard, practically every single team where I worked has done it this way and any change to this workflow was much discussed and temporary - and I've seen that happen only 2 times ever in my 12 years of SWE consulting career. I'm really surprised you are acting as if this was the first time you heard the term.

And - we got it already, you're a Git ninja. You can stop trying to show us your superiority now. The discussion would be much more pleasant - and I'm not saying this because you know more about Git than me, I'd be happy to learn. ;-)