git 存储库中的分支不变目录

发布于 12-02 21:40 字数 354 浏览 0 评论 0原文

有没有办法让 git 存储库中的目录在所有分支中始终相同?

我想到的场景如下:考虑您正在开发一个项目/论文,您正在其中进行大量实验(即创建一个分支,尝试一些东西/进行测量/统计,通常不会将其合并回主版本)加上您编写了一篇文档/论文,其中您希望获得所有(包括实验)分支的内容/结果。来回切换分支当然适用于实验本身,但对于您的文档/论文,您实际上始终只需要一个当前版本

另一种方法是将您的文档放入一个单独的分支(就像某些项目所做的那样),但我个人觉得每当您想向文档/论文添加某些内容时总是进行切换很烦人。

我也可以有两个存储库,但这在某种程度上违背了我对存储库的直觉,因为包含有关项目 XY ​​的所有内容...

Is there a way to make a directory in a git repository always the same in all branches?

The scenario which I have in mind is the following: consider you are working on a project/thesis where you are experimenting a lot (i.e. creating a branch, try something out/do measurements/statistics, typically not merge it back to master) plus you write a documentation/thesis where you want to have content/results from all (incl. experimental) branches. Switching back and forth the branch of course works for the experiments itself, but for your doc/thesis you really only want a single current version at all times.

An alternative would be to put your doc into a separate branch (like some projects do), but I personally find it annoying to always switch whenever you want to add something to your doc/thesis.

Also I could have two repositories, but that somehow goes against my intuition of a repository as the thing that contains all stuff about project XY...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

池予2024-12-09 21:40:10

查看简单但笨重的 git 子模块 或更光滑但更复杂的 git 子树

它们允许您将单独的存储库嵌入到您的存储库中,这可能会满足您的目的。

Take a look into the simple but clunky git submodule or the slicker but more complicated git subtree.

They let you embed a separate repository into your repository, which might serve your purpose.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文