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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Advantages of Monolithic Version Control

92 点作者 benkuhn大约 10 年前

11 条评论

lmm大约 10 年前
I view the repo as the unit of versioning. If something has its own release cycle with its own semver number, it should be in its own repo, and vice versa. Monorepos make sense if your whole site is at a single version, as in the article. But if you want to have libraries that have stable versions (which I find useful, because it allows teams to own codebases - and I find maven is much much better than this article seems to think) then it's worth putting them in their own repositories.
评论 #9563981 未加载
评论 #9565574 未加载
nothrabannosir大约 10 年前
<i>Of course, there are downsides to using a monorepo. I’m not going to discuss them because the downsides are already widely known and discussed.</i><p>I searched but I honestly can&#x27;t find them. The only things I can think of are: implementation problems (repo too large, every git pull takes more time than strictly necessary for your project) and tainting tools like &quot;git log&quot;.<p>Those don&#x27;t seem very fundamental. Solvable by a &quot;monogit&quot; wrapper, if someone put their mind to it. Or are they?<p>Is there a fundamental problem I&#x27;m missing? I feel stupid for asking, given how matter of fact he dismissed it :(<p>EDIT: I guess what I&#x27;m trying to say is: monorepos feel, theoretically, like a strict superset of many independent ones. It&#x27;s just the tooling that makes it less convenient.
评论 #9563878 未加载
评论 #9564416 未加载
评论 #9563962 未加载
评论 #9564814 未加载
otibom大约 10 年前
Could an alternative be to use individual repos and also a meta-repo? The metarepo contents are the commit ids of each individual repo.<p>So let&#x27;s say you want to update a repo which depends on another one:<p>Update project A, commit changes.<p># Your product hasn&#x27;t changed at this point<p>Update project B, commit changes.<p># Your product hand&#x27;t changed at this point<p>In metarepo, checkout to the new &#x27;master&#x27; branches of Projects A and B, commit that to metarepo<p># Your product is now updated!
评论 #9564299 未加载
erikb大约 10 年前
Both variants are nasty in a huge repo. The quoted example at the end is a good example. If you have different repos, you sometimes can&#x27;t push to repoA because you are depending on repoC. If everything is in one repo it should just work. But that&#x27;s not really the case. You still need to wait for changeC before you can go and do changeA. Same problem, independent of the repo situation.<p>The solution is that changeA must be backwards compatible. In a complex system you always need to have some kind of backwards compatibility, at least for some time.<p>In the end both (mono and multi repos) doesn&#x27;t really work in huge, complex scenarios.
moron4hire大约 10 年前
Malarky.<p>&gt;&gt; With multiple repos... having to split a project because it’s too big or has too much history for your VCS is not optimal... With a monorepo, projects can be organized and grouped together in whatever way you find to be most logically consistent, and not just because your version control system forces you to organize things in a particular way.<p>Uuuuh, if your one project has to be split because it&#x27;s too big for your VCS, then you aren&#x27;t going to make that thing smaller by putting multiple projects in with it.<p>&gt;&gt; A side effect of the simplified organization is that it’s easier to navigate projects.<p>That&#x27;s a UI issue. Build a better UI, don&#x27;t use a dirty hack, especially one that has other implications.<p>&gt;&gt; A side effect of that side effect is that, with monorepos, it’s often the case that it’s very easy to get a dev environment set up to run builds and tests.<p>With the growing trend of package managers being able to install dependencies straight from a git repository, I don&#x27;t see this being an issue much longer. Again, this is a UI issue.<p>&gt;&gt; This probably goes without saying, but with multiple repos, you need to have some way of specifying and versioning dependencies between them.<p>Yeah, no shit, that&#x27;s just good software development. The argument here is that a monorepo lets you be lazy.
评论 #9564655 未加载
w_t_payne大约 10 年前
The right approach depends on your configuration management strategy, which in turn depends on the kind of product you are making.<p>If you are developing a big system with lots of components that need to work together (e.g. an embedded machine vision system with a multitude of related data-recording, calibration, simulation &amp; test utilities and subsystems), then the matrix showing which versions and configurations are compatible with one-another quickly grows to an unmanageable size.<p>Unless you have a god-like configuration management system, the only practical approach is to go &quot;green trunk&quot; and co-version all of your components. Granted, this doesn&#x27;t necessarily <i>force</i> you to use a single repo, but a single repo is (at least initially) the simplest approach.<p>Of course, you could go &quot;old-skool&quot; and define interfaces up-front then freeze them, but this just slows your development down to a snail&#x27;s pace. Better (IMHO) to co-version your components then lean on your integration tests to maintain compatibility.
评论 #9563787 未加载
qznc大约 10 年前
One big issue where I would love Open Source to innovate: Test downstream.<p>If you change an Open Source library there is no way to check with users of your library, because they are hard to track down and use various different build processes. In a monorepo, this is much easier. You could create an automatic &quot;build and test everything&quot;.
评论 #9565269 未加载
Eridrus大约 10 年前
For a moment I was a little frustrated at how we split everything into separate repos at work, mostly due to the difficulty of finding and refactoring code.<p>And while a monorepo would help a lot with discoverability, I think that the promises this article makes about cross-project changes are a bit optimistic since it ignores the difficulty of doing deployments in live distributed systems. Even if you have a single git repo, there will certainly be an order you need to deploy them in so that things don&#x27;t break when the API consumer gets updated before the API provider. Google&#x2F;FB&#x2F;Twitter&#x2F;etc certainly have a better deployment system than we do, so maybe for them it&#x27;s easy, but it&#x27;s not something that is just solved by going to a monorepo.
kossmoboleat大约 10 年前
I wonder if Google is still using Perforce? That&#x27;s one of the arguments used at our company to argue that perforce handles huge repos very nicely.
评论 #9563793 未加载
评论 #9564021 未加载
评论 #9567214 未加载
评论 #9564075 未加载
deathanatos大约 10 年前
&gt; Me: I think engineers at FB and Google are probably familiar with using smaller repos (doesn’t Junio Hamano work at Google?), and they still prefer a single huge repo for [reasons].<p>I&#x27;m a former such engineer; I still prefer smaller repos. There&#x27;s enough engineers at both companies that I can assure you such opinions (and knowledge) are quite varied.<p>&gt; it’s often the case that it’s very easy to get a dev environment set up to run builds and tests.<p>I&#x27;ve worked with both; in both cases, the workflow was essentially a checkout, followed by a build, followed by running the tests. I&#x27;ve found this is more a product of the environment (i.e., do the developers care about tests being easy to run) than the VCS in use.<p>&gt; With a monorepo, you just refactor the API and all of its callers in one commit.<p>I&#x27;d restate this: with a monorepo, you <i>must</i> refactor the API and <i>all</i> of its callers in one commit. You cannot do it gradually, or you <i>will</i> break someone. A gradual refactor is only possible in multiple repositories, specifically multiple repositories that obey something resembling semantic versioning. You make your breaking change, and because it is a breaking change, you up the version to indicate that. Reverse-dependencies wishing to update then must make the change, but can do so at their leisure.<p>I&#x27;ve seen some truly heroic work done to get &quot;APIs with thousands of usages across hundreds of projects get refactored&quot;. Sometimes it _is_ easy: you can track down the callers with a grep, and fix them with a perl script. But I think you must limit yourself to changes of that nature: massive refactors too great for a script would leave you to edit the call sites. Though, with thousands of callers, this is probably true anyways, I find having to move even a couple dozen through a major change (such as one where the paradigm expressed by the API is completely wrong) is difficult if you must update them all at once.<p>Last, the most common &quot;monorepo&quot; system I&#x27;ve seen is Perforce, and compared to git it has such stark usability issues that I&#x27;d rather not go back to it (staging, git add -p, bisect, real branches). This comment though,<p>&gt; where it’s impossible to do a single atomic commit across multiple files<p>I would hesitate to use &quot;atomic&quot; to describe commits in Perforce; if you check out CL X, make some changes, and &quot;commit&quot; (&quot;submit&quot; is Perforce&#x27;s term), the parent of your new CL might be Y, <i>not</i> X, and you might get no warnings about this, either. Collisions on an individual file will prevent the submit from going through, but changes on separate files (that together represent a human-level merge conflict) , will not get caught. (They wouldn&#x27;t show as merge conflicts in git, either, but git will tell you that someone updated the code, and refuse your push; unit tests must catch these, but in Perforce&#x27;s case, you must run them after making your change permanently visible to the world.)
评论 #9565949 未加载
JDDunn9大约 10 年前
I&#x27;ve found companies typically use monolithic development because they don&#x27;t get all of the benefits of modular development. e.g. they don&#x27;t re-use code cause they only have 1 website (and don&#x27;t care about open sourcing). I&#x27;ll stick with modular all the way. :)
评论 #9563489 未加载