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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Show HN: Vdm, a sane alternative to e.g. Git submodules

100 点作者 ryapric10 个月前
Hey folks! I&#x27;ve been working on something on &amp; (mostly) off for a little over a year, and picked it back up recently because of yet another related frustration at work.<p>I&#x27;ve spent a lot of time ripping out git submodules from repos my teams use, but I&#x27;ve spent an equally large amount of time wondering why there doesn&#x27;t seem to be a better option for managing arbitrary dependencies across repos in the Year of Our Lord 2024. So, I put together a really early version of such an arbitrary-dependency manager. It&#x27;s called vdm, and you can find it in the linked URL above &amp; below.<p>I&#x27;m sharing mostly because I&#x27;m curious if I&#x27;m blatantly missing some other tool that exists that <i>isn&#x27;t</i> language-specific (like Bit for JS seems to be, for example), but also in case people have any hot-takes or feedback on the functionality as listed in the README.<p>Also of note is that I&#x27;m not sharing to potentially monetize or &quot;generate customer interest&quot; or anything -- I&#x27;m just another builder on the internet.<p>Thanks for looking, and let me know if you have any questions!<p>vdm: <a href="https:&#x2F;&#x2F;github.com&#x2F;opensourcecorp&#x2F;vdm">https:&#x2F;&#x2F;github.com&#x2F;opensourcecorp&#x2F;vdm</a>

25 条评论

posix8610 个月前
Nice!!<p>If you&#x27;re looking for alternatives, here&#x27;s something we&#x27;ve built (hope I&#x27;m not hijacking this): <a href="https:&#x2F;&#x2F;github.com&#x2F;audiotool&#x2F;pasta">https:&#x2F;&#x2F;github.com&#x2F;audiotool&#x2F;pasta</a><p>It&#x27;s called &quot;pasta&quot; for copy pasta. It was built with exactly the same motivation aa yours, also has a yaml config file, and is also implemented in go, kinda interesting. If yours takes off and we can drop ours, that&#x27;d be awesome!<p>For some feedback in features we have which we thinkg we&#x27;d be missing:<p>- we have the ability to copy individual files and specific <i>subdirectories</i> of other repos, not the entire repos<p>- mechanics to &quot;clear&quot; the target directory, in case a file gets deleted upstream, to keep the directories in sync<p>- we&#x27;ve modelled it with a plugin API, so you can implement new &quot;copiers&quot; for bitbucket, google drive, subversion, ...<p>- the github plugin we have uses the Github API for better performance, and you can add auth by setting an env var GITHUB_TOKEN<p>We also create a &quot;result&quot; file of every copy, noting the exact commit that was copied, which might or might not be a useful... Were thinking of posting it here at some point but never got around to it. Again, if yours takes off, that&#x27;d be the best option :)<p>We&#x27;re using it mostly to copy .proto definitions from one repo to another.
glandium10 个月前
Probably unpopular opinion: git submodules are just fine. They&#x27;re &quot;just&quot; lacking a consistent UI. They have improved over the years, but the default config sucks because the defaults emulate the original, awful, UX. With proper configuration, it&#x27;s much better, although there are still pain points (like rebase conflicts in non-submodule parts messing things up if you don&#x27;t git submodule update)
评论 #41099015 未加载
评论 #41108978 未加载
评论 #41128303 未加载
评论 #41106536 未加载
comex10 个月前
If it just clones the repos and removes the .git directories, then I assume it doesn&#x27;t keep their commit history? So if you use e.g. `git blame` or `git log` to look at file history, you will see when changes were introduced to the parent repo, but not when&#x2F;why those changes were made in the first place.<p>In that respect, it resembles git-subtree with --squash, but differs from git-submodule or regular git-subtree.
评论 #41098251 未加载
quilombodigital10 个月前
To me, the biggest indicator that all the links being posted here about Git submodule systems come from people who don&#x27;t know what they&#x27;re doing is the fact that all of them (vdm, pasta, peru, git-aggregator, etc.) are using YAML as a config. Anyone who has worked at least a few years with Git and YAML knows that this type of file is not Git&#x2F;diff friendly. I&#x27;ve seen too many disastrous merges, and the developers in the company have to keep using unityyamlmerge to resolve a foolish decision by Unity. Moreover, if anyone here has tried to parse YAML, they understand how unnecessary it is to use this format 99% of the time. In your case, the only advice I can give is to use a complete repo config per line, so it doesn&#x27;t spread across different lines. This ensures the atomicity and integrity of your information.
评论 #41107385 未加载
评论 #41114095 未加载
greatgib10 个月前
If you are looking for something very light and efficient, let me suggest you to give a try to:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;fviard&#x2F;svn_xternals">https:&#x2F;&#x2F;github.com&#x2F;fviard&#x2F;svn_xternals</a><p>Despite the README saying that it is a work in progress, the tool is functional for a few years already. Also, again despite the name, it works with GIT.<p>The idea is to be able to use the concept of &quot;externals&quot; from SVN transparently with svn or GIT. It does something similar to what Google &quot;gclient&quot; was doing but in a more efficient way (ie a lot faster and consuming a lot less resources).<p>To use it, you just need to create a file (&quot;externals.conf&quot; in your project for example), in a format like that:<p>externals.conf<p><pre><code> git@github.com:user&#x2F;myproject_core.git myproject&#x2F;core git@github.com:user&#x2F;myproject_plugins_onething.git myproject&#x2F;plugins&#x2F;onething git@github.com:anotheruser&#x2F;another_thing.git@mybranch myproject&#x2F;plugins&#x2F;another_thing git@github.com:corpuser&#x2F;random_library.git@release-tag-123 myproject&#x2F;vendor&#x2F;random_library </code></pre> Then, you can simply run: python3 externalsup.py<p>And it will take care to do automatically the git clone, or pull, or &quot;switch&quot; if you change a branch&#x2F;tag indicator in the externals file.<p>Like that, you can easily commit a externals.conf file in a root project folder, and individually manage the version of sub-components that can be hosted anywhere.<p>The &quot;externals.conf&quot; file is a plain text file so easily to read and diff to compare different versions of your project.
lioeters10 个月前
Git Subrepo is another alternative to submodules and subtree.<p>&gt; This git command clones an external git repo into a subdirectory of your repo. Later on, upstream changes can be pulled in, and local changes can be pushed back. Simple.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;ingydotnet&#x2F;git-subrepo">https:&#x2F;&#x2F;github.com&#x2F;ingydotnet&#x2F;git-subrepo</a><p>After trying many similar solutions, it gets the closest to what I want to achieve, which is nested Git repositories. A project with subprojects, each of which can be an independent Git repo with its own history to push&#x2F;pull, while the project itself has the entire codebase and history.<p>It&#x27;s written in Bash, so fairly portable.<p>---<p>Edit: After skimming through the project vdm, I see the problems it aims to solve are different from what git-subrepo does. The latter is more about monorepos. Ah well, that&#x27;s what I get for commenting before reading the post.<p>vdm does look useful for managing a project with external dependencies, which are Git repos owned by others or oneself. Maybe like a language-agnostic package manager.
djha-skin10 个月前
I made a full dependency manager called Degasolv[1] capable of managing arbitrary code in zip files some years back. I wrote it in Clojure. It has features for hosting zip repositories, version comparison, transitive dependency resolution, the whole nine yards.<p>I poured my heart and soul into it[2] but it wasn&#x27;t very popular. I guess there&#x27;s not much need for a dependency manager that&#x27;s not tailored to the needs of a particular community, like a platform or language.<p>1: <a href="https:&#x2F;&#x2F;github.com&#x2F;djhaskin987&#x2F;degasolv">https:&#x2F;&#x2F;github.com&#x2F;djhaskin987&#x2F;degasolv</a><p>2: <a href="https:&#x2F;&#x2F;degasolv.readthedocs.io" rel="nofollow">https:&#x2F;&#x2F;degasolv.readthedocs.io</a>
foooorsyth10 个月前
Looks cool! Seems functionally similar to AOSP’s git-repo, but already feels more approachable with that simple yaml remote list.<p>What collaborative tool would you recommend using with vdm? AOSP has gerrit which is sort of specifically designed for this multi-remote meta setup. GitHub&#x2F;GitLab don’t play nice with this type of environment.
评论 #41098065 未加载
评论 #41097975 未加载
iFire10 个月前
I&#x27;ve have great experiences with <a href="https:&#x2F;&#x2F;github.com&#x2F;ingydotnet&#x2F;git-subrepo">https:&#x2F;&#x2F;github.com&#x2F;ingydotnet&#x2F;git-subrepo</a>
prpl10 个月前
I think you’re going to find that, out there, somebody has already built this. I’ve built one, and worked on two others that somebody built. Usually they have names like workspace manager or repo manager or whatever. Most will probably have something to build a dag and code to do a topological sort for the recursive projects. The better ones will use the topological sort to pull repos and build in parallel.<p>In addition, other tools can also do this to varying degrees of success, like Bazel and cmake.
rendaw10 个月前
What problems are there with git submodules and how does this solve them? The readme isn&#x27;t forthcoming in this respect.
lmz10 个月前
I previously saw <a href="https:&#x2F;&#x2F;github.com&#x2F;buildinspace&#x2F;peru">https:&#x2F;&#x2F;github.com&#x2F;buildinspace&#x2F;peru</a> in use. Seems somewhat similar.
t_believ-er87310 个月前
Nice! As an alternative backup tool, you can look at GitProtect Backup &amp; Disaster Recovery for GitHub, Bitbucket, and GitLab. It allows you to pick up the storage (Cloud&#x2F;local or both), automate backups by scheduling them at the most appropriate time, avoiding throttling, and restore data immediately from any point in time in case of failure, and many other features that meet pain points.
sebastienbeau10 个月前
In our case we do not use submodules, because we need to apply some patch or PR to the dependency.<p>To solve it we use git-aggregator (I am not the autor) (language agnostic too). It seem to have the same features as VDM + some extra one (possiblity to have a frozen file, possibly to apply patch&#x2F;pr...)<p>Source : <a href="https:&#x2F;&#x2F;github.com&#x2F;acsone&#x2F;git-aggregator">https:&#x2F;&#x2F;github.com&#x2F;acsone&#x2F;git-aggregator</a>
keithnz10 个月前
I quite like <a href="https:&#x2F;&#x2F;github.com&#x2F;ingydotnet&#x2F;git-subrepo">https:&#x2F;&#x2F;github.com&#x2F;ingydotnet&#x2F;git-subrepo</a><p>This allows you to treat common code in a repo as just a normal part of the repo. However, the common code is also in a repo of its own. This tool then allows you to push &#x2F; merge your changes back to the common repo.<p>Check the git page for a list of the benefits.
samtheprogram10 个月前
I think submodules make sense in a lot of use cases, but a gotcha I saw with a team introduced to them recently is that pulling down from a branch or switching branches doesn’t update the submodule and&#x2F;or stop you from changing branches if it is modified without being committed in some way.<p>If I could have submodules that operated that way I think submodules would be a lot more straightforward to newcomers.
评论 #41098302 未加载
评论 #41098321 未加载
7e10 个月前
How does this compare to git-subrepo?
评论 #41098421 未加载
kadoban10 个月前
Does it do anything to help manage the .gitignore file(s)? Otherwise I&#x27;d think you have to specify the dependency in both places consistently, which sounds a bit tedious.
alex773410 个月前
For projects where I can&#x27;t trust that the people involved can deal with submodule bullshit correctly I just use these git aliases:<p><pre><code> box = !cd ${GIT_PREFIX:-.} &amp;&amp; git config --get remote.origin.url &gt; .gitboxinfo &amp;&amp; git rev-parse --abbrev-ref HEAD &gt;&gt; .gitboxinfo &amp;&amp; git rev-parse HEAD &gt;&gt; .gitboxinfo &amp;&amp; mv .git .gitbox &amp;&amp; git add -f .gitboxinfo &amp;&amp; true unbox = !cd ${GIT_PREFIX:-.} &amp;&amp; mv .gitbox .git &amp;&amp; true </code></pre> Then I add the .gitbox folder to gitignore. Whenever I need to interact with the &quot;submodule&quot; repo I unbox, otherwise I leave it boxed and as far as everyone else in the project is concerned, the dependency was just copied n pasted in the project.<p>If you ever need to regenerate the gitbox folder from scratch you can take a peek at the gitboxinfo file and git clone and reset the dependency repo in a temp folder, then move the git folder next to the gitboxinfo file.<p>Plus unlike submodules with this you can have local changes to the submodule files without having to fork the submodule itself.
评论 #41098460 未加载
TekMol10 个月前
For a Python project, what are the pros&#x2F;cons of<p>1: A setup.py that installs dependencies like this:<p><pre><code> pip install git+https:&#x2F;&#x2F;github.com&#x2F;dependency&#x2F;repo </code></pre> 2: Git submodules<p>?
评论 #41098325 未加载
评论 #41098295 未加载
000ooo00010 个月前
Not so much of a hot take as some confusion: what are the pain points of Git submodules that lead to this tool? You imply they&#x27;re &#x27;not sane&#x27;, worse but don&#x27;t mention any of the deficiencies that your tool overcomes.
frizlab10 个月前
The project looks interesting.<p>Regarding the name, I’m French, and VDM basically means FML in French.
anakaiti10 个月前
nice! I&#x27;ve been using jsonnet-bundler for this, even for non-jsonnet projects.
neeh010 个月前
Another solution that &quot;nix&quot; solved years ago.
iveqy10 个月前
This seems to be almost the same as androids repo tool. <a href="https:&#x2F;&#x2F;android.googlesource.com&#x2F;tools&#x2F;repo" rel="nofollow">https:&#x2F;&#x2F;android.googlesource.com&#x2F;tools&#x2F;repo</a><p>Personally I don&#x27;t see the difference between this and submodules. Repo stores the information in xml files, vdm stores it in yaml files and git submodules in the git database. I don&#x27;t really care.<p>The real headache for me is the trouble of traceability vs ease of use. You need to specify your dependencies with a sha1 to have traceable SLSA compliant builds, but that also means that you&#x27;ll need to update all superrepos once a submodule is updated. Gerrit has support for this, but it&#x27;s not atomic, and what about CI? What about CI that fails?
评论 #41097929 未加载
评论 #41098106 未加载