TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Please stop recommending Gitflow

470 pointsby gortokabout 5 years ago

72 comments

simonwabout 5 years ago
The approach that has worked best for me is pretty simple.<p>Master should always be in a deployable state.<p>Any commit that lands on master must include unit tests that demonstrate that it works (or at least doesn&#x27;t break anything).<p>Incomplete features that will take more than a week or so to develop should be merged to master early protected by feature flags. This avoids long running branches.<p>I like squash commits: build a feature iteratively in a branch + pull requests, squash to master once it has the tests and documentation bundled together with the implementation. This gives you linear history.<p>People who prefer to review smaller commits can do so in the pull request - it&#x27;s only the finished item that gets squashed into a larger commit.
评论 #22491039 未加载
评论 #22490633 未加载
评论 #22491001 未加载
评论 #22491277 未加载
评论 #22490883 未加载
评论 #22492319 未加载
评论 #22491996 未加载
评论 #22491049 未加载
评论 #22491052 未加载
评论 #22502812 未加载
评论 #22490704 未加载
ryanackleyabout 5 years ago
This cycle seems to repeat endlessly in our industry:<p>* Early adopter independently comes up with an idea that works well for his&#x2F;her team.<p>* Writes an innocent well-written article or book.<p>* Idea somehow becomes dogmatic. Even for situations that don&#x27;t make sense.<p>* After some time, people rebel against dogma because they realize it doesn&#x27;t make sense for every situation.<p>* Original idea now considered anti-pattern even though it may still make sense for some people or situations.
评论 #22488893 未加载
评论 #22490140 未加载
评论 #22492321 未加载
评论 #22489945 未加载
评论 #22492795 未加载
评论 #22488932 未加载
autarchabout 5 years ago
The author says:<p>&gt; While I hesitate to say “Worrying about merge conflicts” is a valid reason not to pursue a branching strategy like gitflow<p>I do not hesitate! This is _very good_ reason to avoid gitflow.<p>Merge conflicts by definition require human intervention. And human intervention means an opportunity for human error. Resolving merge conflicts properly ranges from trivial to nearly impossible, depending on the specific changes you&#x27;re trying to merge.<p>Often none of the authors involved in the conflict are in a good position to understand why it happened. One person makes a small bug fix change to a few lines of code. But that fix required hours of research and a solid understanding of the problem. Meanwhile, someone else is doing a refactoring of that same code in another branch, unaware of the bug.<p>Neither of these two people may be in a good position resolve the conflict. The bug fixer doesn&#x27;t understand the refactoring, so they don&#x27;t know how to apply the bug fix in the new code. The refactorer doesn&#x27;t understand the subtleties of the bug fix and the code being fixed is just gone in the refactor. It&#x27;s going to require the two of them working together to fix this, and it may took several more hours and they still may not get it right. And that&#x27;s the best case! Realistically, one person will muddle through the merge and hope that things still work properly.<p>Of course, merge conflicts are a fact of life in _any_ version control scheme without exclusive locks (remember RCS?), but minimizing them is a very valid goal.
评论 #22489939 未加载
评论 #22493155 未加载
评论 #22493454 未加载
评论 #22489921 未加载
alexhutchesonabout 5 years ago
It&#x27;s honestly crazy how much time we as a community of software developers spend thinking about Git. We spend time training new engineers how to use it, we spend time researching how to un-wedge ourselves when we run into problems, we spend time standardizing preferred workflows and giving feedback when someone doesn&#x27;t follow them, and we seem to spend time debating the proper branching workflows within each team or company once every couple years. When all those costs are added up, I felt more productive using svn. I can&#x27;t be the only one.<p>Ultimately I think the problem is that Git solves too many problems - it provides a very general data structure that can be used in a lot of different ways, but the tooling itself is mostly agnostic to how you want to use that data structure. Teams can define preferred workflows on top of that, but the tooling itself doesn&#x27;t enforce the workflow, or provide any specific affordances that help you properly comply with the workflow. Instead, every developer is supposed to keep the workflow in their head, and make judgement decisions every time they interact with it.<p>The cost of this is huge. We&#x27;re sorely in need of opinionated tooling that sits above Git&#x27;s data structures and makes real-world workflows simple to follow correctly, and difficult to mess up.
评论 #22489397 未加载
评论 #22489405 未加载
评论 #22489300 未加载
评论 #22492550 未加载
评论 #22497977 未加载
评论 #22491819 未加载
评论 #22489737 未加载
评论 #22489605 未加载
评论 #22490091 未加载
cryptonectorabout 5 years ago
+1e6.<p>Rebase workflows are the best. We used them at Sun long before anyone called it rebasing, long before even any VCSes had the feature in any way. It&#x27;s the only workflow that works in large codebases (monorepos, repo forests) with thousands of developers. Merges stop being interesting very quickly once you&#x27;ve got a) a large number of developers, and b) a high rate of commits on the same codebase -- it&#x27;s just too much metadata.<p>Linear history works like a charm and is super easy to understand (because it&#x27;s linear).<p>Nobody cares about the internal history of a feature branch that has delivered. One should only care about what mainline bugs were fixed and what features were added -- bugs that never made it to the mainline are simply not interesting at all to developers on the mainline (though admittedly they might be to someone studying developer performance, but then, feature branch history can be kept and archived, just not on the mainline).
评论 #22491856 未加载
评论 #22489248 未加载
trixie_about 5 years ago
I&#x27;m in the camp that rebasing is unnecessary and useless for large projects. I work in a code base with 50 other devs, no one is reading the commit log line by line, there are 100 commits per day. We use JIRA and have to prefix our commits with TICKET-&lt;ID&gt;. If I want to see the commits for a ticket, I filter the git log on that. If I want to see the combined diff for the commits, I open up the PR in JIRA.<p>Squashing public commits I&#x27;m also against. People say it &#x27;cleans&#x27; the history. I would say it erases it. Who, when, why - all gone. For what? to save a few commit lines? Like I said, our commits are tagged with the ticket number already, if you want a summary of what the changes were and all the commits that were part of it, you open the ticket, or filter the git log on the ticket. No need to move commits around in the history, they show in the same order when you apply a filter.
评论 #22491559 未加载
评论 #22492342 未加载
评论 #22491784 未加载
评论 #22491665 未加载
评论 #22491588 未加载
评论 #22495328 未加载
iamleppertabout 5 years ago
I agree 100%. I too tried Gitflow on many different projects, with different skill levels of teams and we ended up pulling the plug on it and going back to &quot;master is always deployable&#x2F;production&quot;. Developers work in feature branches that are small and atomic, with frequent merges into master with corresponding deployments. Breaking master is a critical blocker issue. There&#x27;s no need for tags, complicated release schedules or processes following this model and it scales from a team of 1 to a team of 1000, I&#x27;ve seen it done.<p>Gitflow doesn&#x27;t work in a CI environment on a modern software application that has good testing culture and systems that are resilient to failure.<p>Tools and processes work a lot better when they work for you, not the other way around. KISS.
评论 #22490147 未加载
评论 #22489413 未加载
评论 #22491276 未加载
评论 #22489666 未加载
tootieabout 5 years ago
I don&#x27;t understand the argument here at all. Git flow seems pretty orthogonal to concept of branching lifespan. We did the &quot;merge early, merge often&quot; approach with SVN 15 years ago and it was fine. We do git flow now and it&#x27;s fine. It meshes perfectly with agile development where you work on the smallest feature set that adds incremental value. That means your branch only ever lives long enough to do one tiny thing and it gets merged as soon as it&#x27;s working and no sooner. I&#x27;ve been following this approach for years with dozens of teams and it&#x27;s very successful. And I&#x27;ve never run a rebase on purpose in my entire life.
评论 #22489143 未加载
评论 #22489221 未加载
评论 #22488885 未加载
评论 #22489631 未加载
elyoboabout 5 years ago
I have two long lived branches, develop and master.<p>* major features are done in feature branches, w&#x2F;rebasing prior to merge<p>* minor stuff directly in develop<p>* master is auto deployed following successful CI, whenever we merge develop in to it<p>* we merge frequently, but not automatically<p>* we tag releases manually when we do merge<p>It&#x27;s a more minimal version of git flow. Small teams so not much problem.<p>We could probably just drop the develop &#x2F; master split and still be fine, but would force all changes to be in feature branches instead.
评论 #22489039 未加载
评论 #22488386 未加载
评论 #22490603 未加载
评论 #22488364 未加载
评论 #22489297 未加载
评论 #22489645 未加载
评论 #22488227 未加载
评论 #22489262 未加载
honkycatabout 5 years ago
In my opinion the problem with GitFlow and a lot of other git workflows is you end up holding a bunch of state inside of your git branches which is hard to decipher, complicated to manage, creates work for people ( with merge conflicts, and managing feature branches that need to be merged ), and is capable of losing progress.<p>My solution: USE FEATURE FLAGS. Keep the list of features and refactors you want deployed in a format that is easy to audit and reason about.<p>I like the Microsoft branching strategy: <a href="https:&#x2F;&#x2F;docs.microsoft.com&#x2F;en-us&#x2F;azure&#x2F;devops&#x2F;repos&#x2F;git&#x2F;git-branching-guidance?view=azure-devops" rel="nofollow">https:&#x2F;&#x2F;docs.microsoft.com&#x2F;en-us&#x2F;azure&#x2F;devops&#x2F;repos&#x2F;git&#x2F;git-...</a><p>Basically:<p>* Create feature branches.<p>* Merge into master when the feature is done. For long lived branches: Don&#x27;t keep them around. Merge them into master and put them behind a feature flag.<p>* Deploy to environments using release branches.<p>* USE FEATURE FLAGS. Do not hold state in your github repo&#x2F;branch merge status. Do not control features and refactors inside of your git branches, only merging the code you want to be deployed. Instead, put them behind feature flags and activate them using code.<p>There is a good book on the topic of feature flags titled &quot;Effective Feature Management&quot; that is a good overview. Feature flags do not have to only protect features. You can put refactors behind feature flags as well, or really anything.
评论 #22489387 未加载
评论 #22489804 未加载
评论 #22490171 未加载
CurtBurbingerabout 5 years ago
&quot;Any branching model you choose is ultimately meant to make humans work together more easily to produce software&quot;<p>There are things in this article I agree with, and things that I don&#x27;t, but the quoted point is something that I wish could be universally understood. Some developers commit to the dogma of one blog post or another and forget about the fact that the whole thing is for the _people_ who are writing the code. Branching strategy should help to optimize workflows and minimize friction, regardless of how badly bastardized your approach is vs. its source material.
评论 #22487754 未加载
评论 #22490606 未加载
contingenciesabout 5 years ago
<i>We don&#x27;t use any branching.</i> Git is complicated enough to explain to non-software engineers without branching. We treat all commit versions equally for CI&#x2F;CD. As most people are not software engineers, this seems a reasonable course of action if a project encompasses non software elements. We have non CI&#x2F;CD testing anyway (nontrivial hardware projects require much more external process).<p><i>For releases we assign versions without tags</i>, instead using replication of a subdirectory tree under a version number. This ensures all versions are available locally to all users without adding any access complexity.<p>This is basically optimizing for simplicity for the users.
_haoabout 5 years ago
At work we were using TFS when I joined. I managed to win the battle and migrated everything we have to Git, but for some reason they wanted us to follow Gitflow (other parts of the business were on Git and were using it). A couple of horrible releases, regressions and lost functionality (merge errors) later I managed to push everyone into using Microsoft&#x27;s Release Flow[1]. We haven&#x27;t had a single regression since then and everything in the process is more or less smooth.<p>The funny thing is I&#x27;ve used Gitflow successfully before in another job, but nowadays I&#x27;m mostly scratching my head how it ever worked correctly. It&#x27;s so overly complicated. It would never be my process of choice.<p>[1] <a href="https:&#x2F;&#x2F;docs.microsoft.com&#x2F;en-us&#x2F;azure&#x2F;devops&#x2F;learn&#x2F;devops-at-microsoft&#x2F;release-flow" rel="nofollow">https:&#x2F;&#x2F;docs.microsoft.com&#x2F;en-us&#x2F;azure&#x2F;devops&#x2F;learn&#x2F;devops-a...</a>
评论 #22492449 未加载
kunglaoabout 5 years ago
Something that really surprised me is how anyone has issues with git work flows. Git is one of my favourite software and I think it solves version control and collaboration issues beautifully. I can unhesistently say only one of the teams used git recall really well and we didn&#x27;t agree on a work flow or no one was dogmatic about it. Each seemed to just know what they were doing.<p>I think just create your own branch always for your work is a good idea. Use merges to take or give contributions (reduce using complex things like rebases). If branching on sub branches, try not to squash merge. You can&#x27;t avoid conflicts all the time but just sticking to branching and merging reduces this problem quite a lot. Team size has been about 12 engineers not sure how it&#x27;ll impact team of much larger projects. But I have also contributed to open source projects using this same techniques without an issue.
erik_landerholmabout 5 years ago
We implemented Gitflow almost exactly how it was described in the original blog post a while ago. It was simple and we built continuous deployment around it and it posed 0 challenges in that department. It was much harder to change culture and build a process and systems to actually do the continuous deployment than Gitflow ever caused. I disagree with about everything in this article.
bavellabout 5 years ago
It seems to me that most of the authors objections stem from 100% strict adherence to git flow, which IMO is the wrong approach.<p>I loved the concept of git flow when I first read that legendary blog post. I learned a lot and adapted it into my own development workflow. I&#x27;ve bounced back and forth over the years in how strictly I adhered to the One True Way (tm) based on how well it worked for me in actual projects.<p>IME I think the best approach to git flow is to learn and understand it and then adapt it to your project&#x27;s workflow, as opposed to strictly adhering to every tenet of git flow. I have multiple projects using different &quot;amounts&quot; of git flow - e.g. a large project with dev, qa, hotfix and release branches vs a small personal project with only master and dev.
评论 #22489156 未加载
jconleyabout 5 years ago
In my opinion this is one of those &quot;pick the right tool for the job&quot; problems. If you have a constraint that forces you to have multiple versions in development and maintenance simultaneously then Gitflow works well. This is especially true for things with long QA cycles. If you have a SaaS business and pushed code can go straight to production after automated tests, then don&#x27;t bother with the management overhead of the versions.<p>In personal experience... We use Gitflow for our software that ships on our IoT device where we do monthly releases and multiple weeks of QA&#x2F;reliability testing. Of course, this is coupled with a slow rolling canary release process -- nobody wants customers to be forced return a device due to a bug that can&#x27;t be fixed over the air.<p>We also use it on our mobile app and it works well. Again, this is a situation where we have to have multiple versions in development simultaneously. One in &quot;release mode&quot; doing critical bug fixes only as it goes through QA and internal in-home acceptance testing and one for &quot;v-next&quot;.<p>Some 20 years ago we used to do roughly this same process for releasing software on CD&#x27;s. But, no git back then so no &quot;Gitflow&quot;...<p>We don&#x27;t use it for various services and internal tools that can get by without such rigor around versioning. Just simple branch -&gt; PR -&gt; automated test -&gt; merge to master from PR -&gt; automated test -&gt; deploy.<p>Use the tool&#x2F;process with the least overhead that manages what you need managed.
评论 #22490005 未加载
deckar01about 5 years ago
Most of that blog post&#x27;s workflow seems like pretty normal merge request development. Separating develop and master is where most of the complexity arises. The reported advantage is &quot;the develop branch is cleared to receive features for the next big release&quot;. I have never ran into a problem with features needing to land in master before a release is cut, likely because I have never scheduled releases and I think most projects don&#x27;t. Even if they did, the project has to be pretty massive to have a feature ready, but scheduled for a future release and also be blocking the development of another scheduled feature... If your project is that busy, it is seems like a reasonable workflow. Everyone else can probably just treat master as their develop branch and everything else in the article is pretty good advice.<p>The only other oddity I see is treating hot patches different than feature branches. In my experience, hot patches are no different than feature branches in projects that use master as the branch to deploy from. In projects that perform manual QA, I use a branch for each deploy environment to stagger rollouts, the final branch being for the production environment. In that case it makes sense to start a merge request on the production branch before master.
daenzabout 5 years ago
Speaking for myself, git flow <i>is</i> intuitive. It is something you also have to practice discipline to adhere to. That is not simply &quot;additional cognitive load&quot;, it is just like any other process worth following.<p>Their criticism about &quot;tripling the number of merge conflicts&quot; because of the number of branches doesn&#x27;t make any sense. As long as developers are doing development work and committing, regardless of what branch they&#x27;re committing to, there is potential for conflict. It might not be a &quot;merge&quot; conflict in the sense of two separate branches, but it will manifest as a merge conflict in pushing the local to the remote. The potential for conflicts stay the same. What git flow gets right here is it isolates logical workflows from each other, so people working can work for as long as necessary without conflict.<p>&gt;Gitflow abandons rebasing<p>Rebasing is a nightmare for distributed work, and in my opinion, only makes sense in limited circumstances where your code is not already pushed and pulled in multiple locations.<p>&gt;Continuous delivery is a practice where the team release directly into production with each “check-in” (in reality, a merge to master), in an automated fashion. Look at the mess that is gitflow and explain to me how you’re going to be able to continuously deliver <i>that</i>?<p>Every modern CI&#x2F;CD framework can run automated jobs after a merge into master, so I&#x27;m not sure what the criticism here is?<p>&gt;Have you ever <i>tried</i> a complex branching model like gitflow with multiple teams, and hoped for everyone to be on the same page? Can’t happen.<p>That is less a criticism of git flow and more a criticism of any software organization that tries to have repeatable deployments with many services. It&#x27;s a difficult problem in general, and not one that git flow is attempting to solve in the first place. You will have that problem regardless of if you use git flow or not.<p>I could go on but there&#x27;s a lot here. It sounds like the author is very frustrated and annoyed with git flow, and perhaps is used to cowboying code (the desire for frequent rebasing give me a hint to this) without regard for the impact on other developers. I&#x27;ve worked with people like this, and they often provide no alternative solutions, just frustration and resistance to following an imperfect process. It&#x27;s a rant without much substance.
评论 #22488261 未加载
Buttons840about 5 years ago
&gt; If you pursue gitflow, you’re gonna have to give up rebasing. Remember, rebasing does away with the merge commit — the point where you can see two branches coming together.<p>I disagree with this. You can rebase your branch and then do a &quot;no fast forward&quot; merge. You&#x27;ll end up with something like:<p><pre><code> * Merge commit |\ | * My branch commit 3 | * My branch commit 2 | * My branch commit 1 |&#x2F; * Base </code></pre> Notice I have not &quot;done away with the merge commit&quot;.<p>When you rebase your branch on top of &quot;Base&quot;, and then try to merge, git will by default do a fast-forward merge, but you can prevent it from doing so.<p>It is as though you created your branch, did your work, and then merged it back in so quickly that no other branches were created in the meantime, and if we ignore what I personally did on only my own computer, then I am still following Gitflow.
评论 #22489910 未加载
评论 #22490434 未加载
an-allenabout 5 years ago
Source repositories are all about managing complexity. The more unmerged code you have from your releasable branch... the more complexity you have being held in the source repository.<p>In the field I&#x27;ve seen git-flow lend itself to having trouble handling releasing some features and not others that have already been merged into a release or environment branch. This leads to cherry picking or more complex merging trees. With trunk based development, once a thing is merged to master it is shipped.. so it keeps the complexity being held in unmmerged branches to a minimum.
oweilerabout 5 years ago
git flow never made sense for me. Because of the complexity some devs would always mess things up or ignore the branching altogether. Merging all the related branches into master when doing a release took multiple days and often introduced subtle bugs.<p>Switched at some point to GitHub flow and never looked back.
评论 #22488859 未加载
评论 #22488061 未加载
aaanotherhnfolkabout 5 years ago
My company uses gitflow and releases daily from a monorepo with a team of 40 devs. Some of us rebase. Everyone is happy.<p>I think that disproves just about every point in the blog post.<p>I have no idea what non-obvious thing, if any, we&#x27;re doing to make this work. Then again I don&#x27;t think gitflow is complicated either.
评论 #22491782 未加载
combatentropyabout 5 years ago
Gitflow didn&#x27;t just pop into the head of Vincent Driessen. It seems he curated an opinionated selection of the options from the book <i>Pro Git</i> (<a href="https:&#x2F;&#x2F;git-scm.com&#x2F;book&#x2F;" rel="nofollow">https:&#x2F;&#x2F;git-scm.com&#x2F;book&#x2F;</a>) and I wouldn&#x27;t be surprised if many projects were already using something like it to various degrees.<p>I went for many years with only a master branch and sometimes a develop branch, because I often worked alone. It took me years to venture into branching at all. Before Git I used Subversion. I don&#x27;t think we branched once. But easy branching is one of Git&#x27;s distinguishing features. For me, branching was like learning a programming language. At first it&#x27;s mindbending and intimidating. But with reading, practice, re-reading, and more practice, it can eventually become second nature. The crazy diagram that George Stocker holds up makes perfect sense to me now.<p>I was forced to adopt Gitflow when I joined a bigger team. But now that I have learned it, I kind of like to use it even when working alone. Topic branches remind me of functions, in that they are small and encapsulated. I can concentrate on a narrow range of code and feel safe. The eventual merge might have conflicts, but they are soluble. And the way that feature branches stem from develop while bug-fix branches stem from master, and how you have a release branch to freeze features without freezing work --- I don&#x27;t know, it feels very safe and structured.<p>However, yeah, like Stocker says, it may be too much ceremony, especially if you&#x27;re just starting out. I like to tell people to ease into it. Stop when it hurts.
评论 #22490123 未加载
phodgeabout 5 years ago
I&#x27;ve never liked git flow due to:<p>A) the way it abuses the commit DAG: you never merge master directly back to develop, and so your tags don&#x27;t become ancestors of the commits on develop until some timer later when an unrelated hotfix is branched from master. E.g., you can&#x27;t rely on &quot;git branch --contains v1.0.1&quot; to tell you which branches do&#x2F;don&#x27;t contain the 1.0.1 hotfix because the hotfix branch was merged to develop, but not the merge commit that was tagged as 1.0.1.<p>B) its blatant disregard for one of the most basic software development principles: when you want to deploy a new version of your software, you test a specific a revision of your code and that&#x27;s the revision that you deploy. With Git Flow, you go to great lengths to ensure your release branch is isolated from other work for testing, but then you merge to master and deploy the merge commit instead of the commit you just tested.
snapetomabout 5 years ago
When I first researched git, this blog post came up. It&#x27;s been around forever.<p>My first thought when reading it, though, was, &quot;huh, we seem to be doing that with SVN already.&quot; Indeed, gitflow just seems to be a popular SVN flow ported to git.<p>Looking at the diagrams, there seems to be a lot of branching and merging, but in practice, it&#x27;s far less than merge early, merge often. In using SVN, though, you can see why. SVN thrived in a day with more large, monolithic codebases. Further, branching in SVN was <i>heavy.</i>. It made a copy of the entire codebase. It wasn&#x27;t fun because it took so long. Gitflow emerged from an SVN world.<p>Nowadays with microservices, modular codebases, and CI&#x2F;CD, a merge early, merge often approach with git makes more sense. There isn&#x27;t nearly the overhead or pains of branching and merging with git as there is with SVN.
Myrmornisabout 5 years ago
100% agreed. The workflow suggested in the viral blog post is far too complicated, even for experienced teams. But in practice what happens is that the teams who are most likely to base their git practices off some random blog post instead of off their own experience are the least experienced teams.
earthboundkidabout 5 years ago
I recommended avoiding Gitflow back in 2018:<p>&gt; There are more complicated systems for branching like Git flow that have a separate “develop” branch and distinguish between “features” and “hot fixes”. These systems are fine if they fit your use case, but if a project releases code quickly, the level of complexity involved in Git Flow is unnecessary.<p>&gt; Ideally, branches should be short lived. One strategy to allow merging a branch before a large feature is fully completed is to create a feature flag that lets the production system have the new code in it but in an inactive state.<p><a href="https:&#x2F;&#x2F;blog.carlmjohnson.net&#x2F;post&#x2F;2018&#x2F;git-gud&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.carlmjohnson.net&#x2F;post&#x2F;2018&#x2F;git-gud&#x2F;</a>
tomervabout 5 years ago
The article claims that &quot;gitflow abandons rebasing&quot;, but this is simply not true!<p>In my team we use gitflow with rebasing. In fact, the original gitflow implementation comes with rebasing support built-in (as a flag for the &quot;git flow feature finish&quot; command). We just modified the script to enable it by default.<p>Another thing we changed is dropping the &quot;master&quot; branch, since it didn&#x27;t provide anything useful.<p>Now, you could claim that this means we&#x27;re not really using gitflow, due to all these modifications. But the fact is, I still give this article as mandatory reading for new developers in our team, and it&#x27;s still a great introduction for working with feature branches. I&#x27;ll continue to recommend gitflow.
评论 #22491034 未加载
ses1984about 5 years ago
Git flow is complicated. So is software. If you work at a place that still ships software instead of just running services, you need something more than continuous delivery and a trunk based workflow. If you provide services, you need to care about at most 3 versions of your software at the same time: the version running in production, the version before it, and the version after.<p>If you ship software you might have to care about every version you ever released to in the last 2 years plus that one super old version your second customer is still using because they refuse to upgrade and shit you need to fix a critical vulnerability that was just published in it.<p>Trunk based dev doesn&#x27;t cut it in that world.
ramzyoabout 5 years ago
The most salient points for me were actually made in the last paragraph. IMO would have improved the article to put this at the top rather than at the bottom.<p>&gt; The crucial point I’m making is to is ask questions of your team: What problems will this branching model help us solve? What problems will it create? What sorts of development will this model encourage? Do we want to encourage that behavior? Any branching model you choose is ultimately meant to make humans work together more easily to produce software, and so the branching model needs to take into account the needs of the particular humans using it, not something someone wrote on the internet and claimed was ‘successful’.
hinkleyabout 5 years ago
I used a watered down version of gitflow on a project with heavy customer involvement.<p>Instead of doing the whole thing, we had feature branches (which I still hate), master, and one more branch for the stuff we were showing to the customer. Who sometimes would decide they didn&#x27;t like what they asked for and please don&#x27;t push this to production.<p>With the exception of hotfixes, master was always just a certain number of commits behind the working branch.<p>Very aggressive use of dark launching of features could also solve this problem, but we&#x27;ve had our share of problems with that strategy too (Sprint-obsessed thinking makes it difficult to go back and clear out old conditionals once they&#x27;ve settled)
zokierabout 5 years ago
One would think by simply looking at the picture that gitflow is not well suited for processes that do not involve distinct releases. In other news, SaaS is not the only model in the world and CD is not always possible.
freetime2about 5 years ago
My team uses git flow as the basis for our branching strategy. We’ve streamlined things a bit over the years as we’ve found we didn’t need all the flexibility&#x2F;complexity in that model, but we’re still using a develop branch, feature branches, release branches, tagging our releases, etc.<p>It works fine for us, and we spend very little effort on branching or merging. I wouldn’t hesitate to recommend git flow as a starting point to any team. Just make sure you don’t follow it dogmatically... if there are tweaks that you can identify to better serve your team, go ahead and make them.
411111111111111about 5 years ago
I disagree with the article. there are pitfalls you can fall into using gitflow, but they&#x27;re not inherent to that strategy.<p>pointing out the obvious: a master branch is technically redundant for gitflow. you just need to create a tag. it however makes it easier to visualize and think about the flow in regard to hotfixes.<p>next obvious point: you&#x27;re just not releasing quick enough if merge conflicts become an issue with gitflow. personally, i think release branches are just quick snapshots you can use to safely run all tests against while other developers keep pushing features on develop. this gives you a short timeframe to merge bugfixes into the release branch, but it really shouldn&#x27;t exist for &gt; 2 days (one day to identify issues and fix them, another to verify that they&#x27;re gone).<p>nor do i see any issue with continues integration, honestly... gitflow just formalizes the way code goes into production. if anything, it makes it easier! now you can automatically spin up new environments for release&#x2F;* branches to automatically trigger a system test suite, appending the result to the release.<p>i dont get his issue of multiple repositories either... each microservice surely has a different version, no? so for what conceivable reason would gitflow create any issue here?<p>if you&#x27;re a three man team, gitflow is probably unnecessary though. its meant for bigger projects with lots of developers pushing at the same time.
Kaotiqueabout 5 years ago
We use a variant of Gitflow without a develop branch and without release branches.<p>Gitflow has 2 major problems: - develop branch that will always become a mess over time - release branches are never completely accepted. It is much easier to accept features branches.<p>We try to merge feature&#x2F;bugfix branches directly to master when they are approved.<p>We have testing&#x2F;staging branches that can be thrown away and re-created from master and re-merge any feature&#x2F;bugfix branches that have to be checked.<p>This has worked very well for the last 5 years or so and we have used it in dozens of projects every year.<p>The fact that testing&#x2F;staging contains no commits (except merge commits) of its own is very useful. You can drop these branches regularly and remove any old feature branches that became stale for some reason.<p>Lastly, I have seen a lot of teams that want to apply complicated Git strategies from day one of a project where it would be much better to just work on one master branch because too much code changes at the same time. This will create complicated conflicts. The history at the start of the project is not interesting. Git history only becomes useful when the project is live and you want gradually add features or fixes.
photoangellabout 5 years ago
Please stop using &quot;Please stop...&quot; in the title of blog posts. It has a passive aggressive, techbro culture, holier than thou ring to it. Which I find grating.<p>That aside, there&#x27;s not much in this article anyway. Despite trashing it in the title, he goes on to say it might work in large organisations or those with a long release cycle, but otherwise can&#x27;t recommend an alternative.<p>Ok then.
评论 #22492646 未加载
评论 #22493646 未加载
评论 #22492689 未加载
bArrayabout 5 years ago
I think Gitflow is the larger picture, but I think most teams can afford to merge parts together.<p>I run a small team and we typically will just use &quot;feature&quot; and the master branch. If it compiles and passes the basic tests, it&#x27;s master worthy. If it passes more heavy testing then it&#x27;s tag worthy. Features can sometimes be bug fixes depending on the size.<p>Typically we try to merge branches in less than two weeks to prevent some kind of merge hell.<p>The assumption that master is somehow perfect is wrong and it shouldn&#x27;t be treated as such. In my opinion tags are really for commenting that there&#x27;s something interesting about a commit (i.e. &quot;we ran this for 2 weeks at full load and no issues observed&quot;). Again, tags also don&#x27;t say there are no issues, it just says there was something note worthy.
rckoepkeabout 5 years ago
I really wish the article covered some alternatives styles.
评论 #22487937 未加载
评论 #22488929 未加载
评论 #22488138 未加载
rawoke083600about 5 years ago
I use:<p>1. Master should be always deployable:<p>2. All features are a separate branch BUT, when merged into master they should also have a config for ON&#x2F;OFF. This has the benefit of quickly switching between old and new behaviour(feature) as well as forcing a &quot;module-based-architecture&quot; for the code.
评论 #22492130 未加载
globular-toastabout 5 years ago
At my current job when I started people were doing git flow. It was horrendously complicated. I got rid of it and now everyone is happier.<p>The idea is really simple. You have one eternal branch, &quot;master&quot;, which is your integration branch. This is set to be the upstream of all other branches during development. That means it&#x27;s really easy to keep rebasing on master every day. When your branch is ready it&#x27;s merged into master (I do fast-forward only, but that doesn&#x27;t matter). When you want to release, just tag a commit on master. If you want to maintain releases, make release branches for these and cherry pick fixes from master. Reset the maintenance branches to whatever release you are maintaining. It&#x27;s easy.
Ace17about 5 years ago
GOTO 2017 • Feature Branches and Toggles in a Post-GitHub World: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=lqRQYEHAtpk" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=lqRQYEHAtpk</a><p>TL;DW: integrate continuously, don&#x27;t use branches, use feature toggles.
jrumbutabout 5 years ago
I recall converging toward something a lot like git-flow because, especially when there were hot fixes, you might get conflicts rebasing the feature branch and conflicts again merging the feature branches, doing the work twice at least. Additionally, it was so important everyone used the same procedure to accomplish merges or whatnot or else there would be all kinds of problems.<p>Sometime ago I noticed I hadn&#x27;t seen this in a while. Is this anyone else&#x27;s experience? Have people just gotten better at git or was there a major improvement in how git handles this scenario?<p>If it was about improvements, has anyone written those changes up? It would be fascinating to know how it was done.
Ace17about 5 years ago
&gt; While I hesitate to say “Worrying about merge conflicts” is a valid reason not to pursue a branching strategy like gitflow<p>Being worried about merge conflicts might be a sign that your continuous integration might not be continuous enough.
Oliproabout 5 years ago
I implemented a variety of GitFlow, but with an emphasis on automation. Normally you branch off of develop; hotfixes will be a branch off of master.<p>Feature branches are combined with develop before being built and tested. If it passes, it becomes mergeable in GitLab.<p>all builds of develop that pass are taggable; you go into the CI interface and specify a tag. Once deployed, master is updated by the CI to point to that tag.<p>The most valuable part of this is the CI pipeline and having a solid body of tests to ensure that changes which don&#x27;t necessarily conflict in Git will most likely be caught during test, prior to it being allowed for merge.
HelloNurseabout 5 years ago
Some of the criticism in the article is unfair.<p>Most obviously, the boundaries of source code repositories should be aligned with released modules: if &quot;the system becomes a manifest of the different revisions of the different repositories&quot; the repositories are too fragmented (or the releases too monolithic), if &quot;teams are independent and microservices should be independently deployable&quot; disparate components should not share a monorepo, and in both cases the difficulties are consequences of bad architectural choices, not of branching models.
federalemployeeabout 5 years ago
Funny, I always interpreted the gray branches in that diagram to mean short lived branches.<p>I just have dev and master with all my projects. Everything else is short lived. And short lived branches are rebased and squashed. Also, all devs work with forks to keep upstream pristine.<p>And there are those dogmatic about trunk development. I think if you follow the rule of thumb of don’t let dev and master get too out of sync you don’t need to do trunk.
readmeabout 5 years ago
The author claims that &quot;rebasing does away with the merge commit.&quot;<p>It&#x27;s true that if you rebase you won&#x27;t <i>need</i> a merge commit, but rebasing is compatible with the idea of having a point of reference between where branches come together, and you can accomplish that by introducing a merge commit with &quot;git merge --no-ff&quot; so the rebased branch doesn&#x27;t fast forward on top of the target branch.
heelixabout 5 years ago
We use several branching strategies - all depends on the size of the codebase and the number of teams involved. Some work just fine with a trunk based workflow, some need that extra bit of layers.<p>What I don&#x27;t get is the infatuation with GitOps, where someone insists on replacing a process with a source code repository and webhooks. Starting to see excessive scripting&#x2F;bots to talk with GIT bots...and it is so kludgy.
6510about 5 years ago
In my ignorance I once pondered a model where [rather than teams] everyone gets their own object named after them. Something like JohnDoe.sortTable(foo)<p>(Besides from being a stupid idea on so many levels) it seems fun to reason about: <i>John doesn&#x27;t sort the table properly.</i> When John gets hit by the bus you have a really good idea what you&#x27;ve lost. You also get to identify the productive and unproductive.
sergiotapiaabout 5 years ago
For the very longest time I thought I was doing gitflow (I skimmed the article back in the day). I wasn&#x27;t.<p>What we do is master is always green, prod ready. Good To Go. Auto shipped to prod by our CI&#x2F;CD.<p>Develop _should_ always be good to go. Green. Auto shipped to staging by our CI&#x2F;CD.<p>Then we have feature&#x2F;ch1238-foobar-baz branches for every feature. Go crazy in there, deliver a completed feature.<p>Is there a need for more process than this?
cs02rm0about 5 years ago
I think gitflow <i>might</i> be suited to mature product work where development is ongoing.<p>It keeps coming up in my consultancy work, usually on short term projects that either die or generally just get left to tick over where it&#x27;s wildly unsuitable. Mostly because of the way it violates that principle of short lived branches.
89visionabout 5 years ago
Anecdotally, it&#x27;s worked well for my current project as any other branching model I&#x27;ve worked with. It allows release validation to happen while developers continue to work on features.<p>The author seems to bash the workflow without offering up any solution or alternative.
u801eabout 5 years ago
Gitflow is really meant for software that multiple released versions. It allows for applying bug and security fixes to older released versions. For a project that has a single released version, it really doesn&#x27;t provide any benefit.
brigandishabout 5 years ago
&gt; Take a look at this image and tell me it’s immediately intuitive<p>I&#x27;m using Git, there&#x27;s nothing intuitive to be found here.<p>On a possibly related note, I watched a talk by D. Richard Hipp (I don&#x27;t remember which one - edit: probably &quot;Richard Hipp - Git: Just Say No&quot;[1]) where he compared it with Git (a lot) and explained how Fossil keeps everything, there&#x27;s no throwing away of history, no need for rebasing (at least as a workflow). It sounded nice - refreshing, even. I&#x27;m going to start using it for some projects and see how I get on, because frankly, I&#x27;m tired of Git and this need to strategise <i>saving copies of my work</i>, because that&#x27;s basically what it does.<p>Sometimes I even pine for the days I used to version zip files…<p>[1] <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=ghtpJnrdgbo" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=ghtpJnrdgbo</a>
artellectualabout 5 years ago
On the contrary my team and I have been having great luck with git-flow.<p>When I onboard a new team member I watch them struggle with git-flow and for me that&#x27;s a great thing to see because I see them learning an efficient way to work.<p>Once they &#x27;get it&#x27; everything flows smoothly, and everyone has the same way of working which makes it very easy to see and help debug when things happen. Communication is also consistent across all team members partly because of the git-flow branching model. We as a team understand why &#x2F; when to use feature branch, when to use hotfix, when to cut a release etc... That&#x27;s what I expect from a team. Git flow has been great for our team and workflow.<p>To each their own. I guess I will continue recommending git-flow.
评论 #22490539 未加载
staredabout 5 years ago
IMHO GitFlow often works, as is a decent baseline.<p>When people don&#x27;t use GitFlow (i.e. people starting their adventure with git, with no supervision), very often they report to one of the above:<p>- one master, and SVN-style<p>- personal branches, and marges in all directions<p>- even more mess<p>Sure, they may be projects in which a different commit&#x2F;branch&#x2F;merge workflow is better. (In many projects I did some adaptations for GitFlow, depending on the project scope, scale and skill of programmers.)<p>However, the original author, after a long criquite recommends nothings (to my disappointment). So, what&#x27;s the point? Going back to this &quot;anyting marges with anything&quot; branch Wild West, as a baseline?
ptahabout 5 years ago
&gt; Ok, so my team shouldn’t use gitflow. What should we use? I can’t answer that.<p>this article is worse than useless. it&#x27;s just a rant about inconveniences without any solutions
评论 #22493287 未加载
luordabout 5 years ago
While I wouldn&#x27;t give as much weight to microservices—because 99% of teams shouldn&#x27;t be using them—he makes quite a few good points.
sitzkriegabout 5 years ago
funny thing about git flow is that working with nvie (who coined&#x2F;created it) at gitprime, they did NOT like it in practice. we just used feature branches go figure
pgporadaabout 5 years ago
We use a rebase heavy workflow and I love it.
m3kw9about 5 years ago
Without looking at how Gitflow works it seems like it’s some Adhoc branch system a lot of company uses in one form or another.
AzzieElbababout 5 years ago
Gitflow was just a silly blog. I can&#x27;t even begin to understand how it became dogma
评论 #22490082 未加载
mariustabout 5 years ago
can I double vote this? :))
mcvabout 5 years ago
Most of this article is nonsense. It&#x27;s true, gitflow is not a silver bullet for every single situation, and if you&#x27;ve got a more complex situation than a single team working on a single project, you&#x27;re probably going to need something that takes the complexity of your situation into account. It&#x27;s also true that gitflow might be a bit too detailed and complex for simpler situations, but you can easily drop parts of it. It&#x27;s not a universal solution to everything, but it&#x27;s a decent basis to start from, particularly if you have no idea how else to organise your git workflow. Because everybody using their own approach without any coordination is definitely going to be worse.<p>&gt; <i>&quot;Gitflow abandons rebasing&quot;</i><p>It doesn&#x27;t entirely do that, but it does abandon rebasing in situations where it should be abandoned. Rebasing is dangerous. Rebasing changes your history, and as any time-traveler knows, messing with history is risky. If you change history that you already shared, you can end up duplicating it and making a mess.<p>Rebasing is only ever fine for local changes, and you can still use it there in gitflow. But if you merge a feature that took some time to develop, into the develop branch, rebasing is a terrible idea, and it should really be done with a merge.<p>&gt; <i>&quot;Gitflow violates the “Short-lived” branches rule&quot;</i><p>Is that a rule? Some features really do take time to develop. Any workflow has to account for longer lived branches. Also, if code has to be reviewed before it can be merged, that also extends the lifetime of branches. Fortunately big merge conflicts are easily prevented by regularly pulling the latest develop into the feature branch.<p>And any situation where you have multiple people potentially changing the same file, is going to lead to merge conflicts no matter what git workflow you use.<p>&gt; &quot;<i>Gitflow makes Continuous Delivery Improbable</i>&quot;<p>Nonsense. Once code has been merged into develop, it&#x27;s ready to deploy. Well, I suppose this one is correct if you consider dropping even the tiniest part of gitflow as completely abandoning gitflow; all continuous delivery teams I&#x27;ve seen, don&#x27;t use explicit release branches; they just deploy develop (or merge to master and then auto-deploy that).<p>The only argument the article uses here is &quot;look at all those lines and dots! this can never work!&quot; Well, it can and does.<p>I&#x27;ve worked in teams that use short release cycles, up to daily, and use a workflow that&#x27;s pretty close to gitflow. It&#x27;s a decent default to start from, but if you&#x27;re working in a more complex environment, with multiple teams working on the same code base, parts of which need to be releasable independently from the rest, then yes, gitflow might not fit your need. So adapt.<p>See gitflow as a starting point, not as a silver bullet. There are no silver bullets.
评论 #22493333 未加载
justlexi93about 5 years ago
Gitflow might work for some projects&#x2F;teams but it shouldn&#x27;t be treated as a reasonable default.
platzabout 5 years ago
As far as I can tell, the only difference between git flow and not git flow is whether you have a Develop branch or not
eindiranabout 5 years ago
I&#x27;ve been swayed to the side of believing that rebase should rarely be used, so that&#x27;s not much of a downside. See: <a href="https:&#x2F;&#x2F;www.fossil-scm.org&#x2F;fossil&#x2F;doc&#x2F;trunk&#x2F;www&#x2F;rebaseharm.md" rel="nofollow">https:&#x2F;&#x2F;www.fossil-scm.org&#x2F;fossil&#x2F;doc&#x2F;trunk&#x2F;www&#x2F;rebaseharm.m...</a>
Ixioabout 5 years ago
Are people really calling this specific model of git branching THE Gitflow model ? For me this was a gitflow amongst others, a gitflow being a git workflow.<p>In the original article &quot;A successful Git branching model&quot; I don&#x27;t see a single mention telling people they should call this specific model Gitflow.<p>For me the word gitflow has the useful meaning of a git branching model, am I in the minority ? Using it as a noun for a specific model seems like a waste of the word.<p>In regards to the article, sure this gitflow is one of the most shared images on the subject. However I recommend that every team use whatever gitflow makes the most sense for them and their project. I was not aware that our industry had a problem with teams cargo culting that specific git workflow.
评论 #22488359 未加载
评论 #22488352 未加载
cpascalabout 5 years ago
&gt; Have you ever <i>tried</i> a complex branching model like gitflow with multiple teams, and hoped for everyone to be on the same page?<p>My company does exactly this and I am happy to report there have been no issues. I think the key reason we don&#x27;t have issues is we are strict about maintaining backwards compatibility between services and also try to maintain forwards compatibility where possible.<p>&gt; “What’s in production” becomes an existential question, if you’re not careful.<p>We solved this by embedding the SHA&#x27;s of a build&#x27;s constituent repos in the build artifact.
somacertabout 5 years ago
I will admit I would not know the difference between gitflow and a hole in the ground. But that diagram looks an awful lot like the workflow you tend to pick up when using fossil.<p><pre><code> * The primary dev branch * branch and merge for feature development * long term branch for each release. </code></pre> The authors only real concern appeared to be no rebase, and rebase is already a big no-no in any sort of distributed development, just adopt that attitude for your personal development.
评论 #22489210 未加载
评论 #22489036 未加载
gwbas1cabout 5 years ago
There&#x27;s nothing wrong with gitflow... The problem comes with how it&#x27;s managed. The problem comes when a risk-averse manager wants to follow a 1990s release cycle, and release and feature branches live forever.<p>Release branches should be created shortly before release, and shouldn&#x27;t deviate too much from develop. Feature branches also shouldn&#x27;t last very long.<p>If a feature is going to be under very heavy development before shipping, a better strategy is to #ifdef the feature. This helps avoid accumulating merge conflicts that happen when there are long lived branches.
评论 #22488044 未加载