TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

The Problem with Git Flow

147 点作者 silasdb将近 5 年前

29 条评论

dastx将近 5 年前
I don&#x27;t quite understand why people don&#x27;t keep it simple. Use short lived branches, and merge to master. Need to do a release? Master is your release. Tag the release when it&#x27;s ready. Need to make a hot fix onto the current deployed version? Create a release branch from the tag, and then create a new tag and merge back to master.<p>This combined with semver gets you far. I&#x27;ve yet to find any downsides with this approach.
评论 #23627127 未加载
评论 #23625117 未加载
评论 #23625310 未加载
评论 #23625145 未加载
评论 #23628152 未加载
评论 #23627029 未加载
评论 #23625140 未加载
评论 #23627228 未加载
评论 #23627196 未加载
评论 #23628622 未加载
评论 #23626549 未加载
评论 #23628118 未加载
评论 #23625610 未加载
评论 #23625098 未加载
评论 #23628687 未加载
评论 #23628820 未加载
评论 #23625114 未加载
wcarss将近 5 年前
Trunk flow has a lot going for it. Here&#x27;s a link in case others don&#x27;t know of&#x2F;haven&#x27;t heard about it -- it starts off with a tl;dr summary: <a href="https:&#x2F;&#x2F;trunkbaseddevelopment.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;trunkbaseddevelopment.com&#x2F;</a><p>One of the key elements of trunk flow that I value about it is that &quot;the software you released&quot; is not a living stream. Because of that, it should not be tracked by a long-lived branch with commits that flow in in over time except in rare fix situations. With trunk flow and similar styles, you can always merge to master, and you can always deploy master. You do so by cutting a new branch, and in my opinion, you then build a static artifact. Next time you deploy, you cut another branch, build your artifact, and put it somewhere.<p>Need to do a hotfix, but there&#x27;s other work since last release that you just can&#x27;t ship? Cherry-pick onto the <i>currently-deployed release branch</i>, not onto some long-lived production branch. There&#x27;s no weird merge-backs, no strange no-op commits in a long-lived history.<p>trunk-flow is also very simple. For these and other reasons, it&#x27;s great.<p>And, some key points about building static deployment artifacts: if you build an artifact to deploy at merge-time to master, you can avoid having your production servers download and execute code for you. You can test your exact artifact before you ever send it to production. You can reproduce your builds. Left-pad-like library unavailability issues can&#x27;t hit between staging and production. Deployments to production are very fast. You can keep a few artifacts around and roll back quickly and reliably to working states (barring database stuff!). You can deploy two versions to different userbases at the same time. It&#x27;s very useful. :)
评论 #23626695 未加载
评论 #23625062 未加载
评论 #23625005 未加载
评论 #23624113 未加载
评论 #23623833 未加载
jdlshore将近 5 年前
Martin Fowler wrote a <i>superb</i> discussion of branching strategies. It&#x27;s here: <a href="https:&#x2F;&#x2F;martinfowler.com&#x2F;articles&#x2F;branching-patterns.html" rel="nofollow">https:&#x2F;&#x2F;martinfowler.com&#x2F;articles&#x2F;branching-patterns.html</a>
viraptor将近 5 年前
I&#x27;ve got strong feelings about git-flow, but I think the main thing all these &quot;generic flow&quot; solutions are missing is: what are your project requirements?<p>Some projects need release branches, some projects use continuous deployment, some projects need manual QA, etc. There is no solution that will work for everyone, so unless your flow description starts with assumptions and matching requirements, it&#x27;s wrong. (for some people reading about it)
评论 #23625068 未加载
dragonwriter将近 5 年前
What a clickbaity title; there&#x27;s no substantial discussion of Git Flow at all; the paragraph they actually spend discussing two minor issues sounds like it was written by someone who has never done serious work in Git Flow.<p>Should be titled “The sales pitch for GitLab Flow”.
danw1979将近 5 年前
&gt; Git flow forces developers to use the develop branch rather than the master.<p>No it doesn’t.<p>&gt; Another frustrating aspect is hotfix and release branches<p>I beg to differ.<p>I know what would be frustrating though:<p>&gt; GitLab Flow is a way to make the relationship between the code and the issue tracker more transparent. Each change to the codebase starts with an issue in the issue tracking system.<p>... tying my repo to one particular git hosting platform.
sn1de将近 5 年前
I honestly thought they were finally renouncing GitLab flow as a massively misguided idea. They are both flawed. You shouldn&#x27;t be using branches in your version control system to denote stages in your development process or deployment targets. It totally breaks down when you move to CICD, which should be your goal. Trunk based is the way to go. These git flow things persist because that is what the search engines puke up when people google for git branching.
评论 #23625075 未加载
评论 #23631118 未加载
servilio将近 5 年前
There is a need for simplified workflows, but this sounds and looks like an exercise in brand marketing more than a good analysis on how to offer a better Git workflows.<p>&gt; Git flow forces developers to use the develop branch rather than the master. Because most tools default to using the master, there’s a significant amount of branch switching involved.<p>I&#x27;d like to see this fleshed out, since whatever branch naming convention or roles you use, you will be switching the same amount.<p>&gt; Another frustrating aspect is hotfix and release branches, which are overkill for most organizations and completely unnecessary in companies practicing continuous delivery.<p>Yes and no. If you don&#x27;t separate master from develop, hotfix branches just work like feature branches. But if you need them separated, then...<p>&gt; Bug fixes&#x2F;hot fix patches are cherry-picked from master<p>Avoid doing this, use daggy fixes[1], and it will make it breeze to check that a fix was actually merged and where[2]. And if you do cherry pick, at least use &quot;-x&quot;.<p>[1] <a href="https:&#x2F;&#x2F;wiki.monotone.ca&#x2F;DaggyFixes" rel="nofollow">https:&#x2F;&#x2F;wiki.monotone.ca&#x2F;DaggyFixes</a><p>[2] git branch --contains &lt;commit&gt;
bredren将近 5 年前
I am a fairly committed practitioner of git flow on multiple projects.<p>The problem of not easily linking feature branch names to issues is real, though I have been solving this using:<p>`[issue id]&#x2F;feature-or-issue-title-abbreviated`<p>And while you don’t get nice hyperlinking from the branch references on GitHub—-and it’s possible for the issue title to be out of sync with the feature branch name at times, it isn’t too bad and I don’t often need to go back and look at a feature branch.<p>Perhaps projects with bigger teams this is more important and the linking &#x2F; strong issue attribution to the branches is more meaningful.<p>I’m less clear on the removal `develop`. It makes more sense to me to use master as this serious “released” state. And for develop to be a bit more loose.<p>More importantly, I typically will run `develop` on a staging instance. So it’s pretty important to me.<p>I still do testing on ‘develop’ and feature branches before they are merged. I also don’t feel like the start &#x2F; finish release process is all that onerous.<p>From a commercial standpoint, I’m not a huge fan of tossing GitLab into the concept name. It’s a little brand-y on something that just doesn’t need it.
评论 #23623246 未加载
ablanco将近 5 年前
I don&#x27;t think this is a problem with git-flow, it&#x27;s more a problem of using git-flow when you don&#x27;t need it.<p>I use git-flow on projects that need to be installed by various different clients and there&#x27;s no way to force all of them to migrate to the latest version, so you have to maintain support for older releases.<p>When the software needs to be installed in a single place and you can do it with CI&#x2F;CD theres no need for the git-flow complexity.
ramenmeal将近 5 年前
I&#x27;m not a fan of merging master -&gt; production for deployments. This means that what you tested in master may not be the same artifact that is deployed to prod. You&#x27;re relying on people to correctly handle merge issues in git. This can become an issue if you have some complex hotfixes that have to happen.<p>edit: I&#x27;d rather trunk based w&#x2F; tagging commits for releases.
评论 #23625453 未加载
somewhereoutth将近 5 年前
I feel a whole lot of problems would just go away if merge was abandoned. Thus every &#x27;merge&#x27; would require a rebase (and subsequent deletion of the merged in branch), and branches stay as branches. For example it then becomes obvious and inevitable that hotfixes must be on an independent maintenance branch (cherry picked in&#x2F;out of the master if appropriate). There is no longer the proliferation of merged in feature branches - only features currently worked on (and yet to be rebased) would have a branch. There is no concept of release vs master vs dev as it is not possible to merge one into the other. Push&#x2F;pull is fast forward or force rebase.<p>Easy enough to write a wrapper around git to do this - I am tempted.
polymeris将近 5 年前
On the topic of Git Flow and simpler &amp; faster alternatives, last month I published a short blog post about my experience learning those alternatives exist at CircleCI[1].<p>The most important learning for me was that things like Git Flow aren&#x27;t free: they slow you down and make developers feel more detached and less responsible for the code that&#x27;s running in prod.<p>[1] <a href="https:&#x2F;&#x2F;circleci.com&#x2F;blog&#x2F;you-are-what-you-git-how-your-vcs-branching-model-affects-your-delivery-cadence&#x2F;" rel="nofollow">https:&#x2F;&#x2F;circleci.com&#x2F;blog&#x2F;you-are-what-you-git-how-your-vcs-...</a>
alkonaut将近 5 年前
I immediately spot one huge issue with this<p>&gt; The production branch is essentially a monolith – a single long-running production release<p>It assumes that only one version is deployed at a time, so you can&#x27;t really service version1.0 after you shipped version2.0.<p>Having multiple independent maintenance branches for production is critical for any branch pattern that should apply to both web software (normally single deployed version) and e.g. Desktop (normally multiple deployed versions).<p>Th
steve_taylor将近 5 年前
This is idiotic. Different situations call for different workflows. Working in a corporate environment with planned, infrequent releases? Use Git Flow. Doing continuous delivery instead? Use the feature branch workflow.<p>This smells like GitLab trying to increase its ownership of the ecosystem.
tupac_speedrap将近 5 年前
How is git flow complicated? I feel like some developers are doing shonky stuff with git branching and then blaming it on the branching strategy.<p>If you used a system with less use of branches you&#x27;d just end up with dodgy code in master instead.
jjuel将近 5 年前
Am I missing something or is this pretty much Gitflow with develop being named master and master named production? Maybe I don&#x27;t fully understand Gitflow or we are using it like Gitlab Flow already with different names.
einpoklum将近 5 年前
My problem with this suggestion is, that I tend to do history rewrites on the development branch, if I realize I&#x27;ve fucked something up; but I don&#x27;t do that on master. So on master, broken things get fixed with a new commit; on development - sometimes, sometimes they get fixed retroactively.<p>That means that you can safely &quot;git pull&quot; the master branch, always, into the future, but if you try to pull the development branch, you may well fail.
somewhereoutth将近 5 年前
I think this sort of thing might become much more tractable if it were possible to visualize a git repo <i>as it actually is</i> - i.e. a directed graph of commits (occasionally with two parents - a merge commit), with moving labels (branch names) and fixed labels (tag names). Like when you buy a small shrub from the garden centre and it has a label attached to it somewhere.<p>Pushes and pulls can then be visualized as two such shrubs reconciling themselves.
评论 #23627258 未加载
rob74将近 5 年前
Interesting tidbit: according to the &quot;SEO-friendly&quot; URL, the title should actually be &quot;what-is-gitlab-flow&quot; - I wonder if that was also the original title of the article, before it was changed into something more &quot;clickbaity&quot;?
pronoiac将近 5 年前
&gt; run <i>all</i> tests on all the commits<p>That gave me pause; I&#x27;m used to relatively small commits, for easier review and verification, so that seemed too much. Reading the link, I think they mean, run tests on every branch on every push.
评论 #23625738 未加载
评论 #23625467 未加载
sebazzz将近 5 年前
We currently use a simplified version of gitflow. Essentially we picked only the master, develop, and release branches from it. Of course we do have experimental branches but all nowhere as complicated as gitflow.
thisisastopsign将近 5 年前
Sometimes I feel there should be a survey for Git methods and people vote on it. Repeat annually. Eventually we&#x27;ll settle the debate
king_magic将近 5 年前
I&#x27;ve literally never had a problem with Git Flow, nor have any developers I&#x27;ve worked with. It&#x27;s fine.
WWLink将近 5 年前
Between monoliths, this discussion, and other complaining about git I see around here, I wonder just how many of you are using subversion lol.
评论 #23624885 未加载
hellofunk将近 5 年前
Trunk-based development FTW!
malinens将近 5 年前
the problem is that gitlab works very bad with other git flows and they are ignoring issues about them so they force their own flow sadly...<p>I still enjoy working with gitlab but this annoys me very much
0x00101010将近 5 年前
man gitworkflows
renewiltord将近 5 年前
Gonna be honest with y&#x27;all. You don&#x27;t need a git workflow. Seriously, YAGNI. Deploy every `master`, no other restrictions.<p>Git workflows are over-engineering.
评论 #23625106 未加载