你如何对你的家进行版本控制?我想要一些有关子存储库的信息

发布于 2024-10-05 08:07:18 字数 785 浏览 4 评论 0原文

我已经开始将一些文件放入 Mercurial 的版本控制中。它从 .vim 开始,然后是 .bashrc,现在我意识到很多其他文件也可以进行版本控制(例如 .zshrc、创建的 .task 目录)由taskwarrior等)

事实是我想知道哪些方法可用以及这里的人们如何做到这一点。

对主页进行版本控制不是一个好主意,因为我需要编辑 .hgignore,并且每次添加我不希望版本控制的新文件夹时,我都需要编辑 .hgignore代码> 也是如此。

所以我想到了两种方法:

  • 创建一个“dotfiles”存储库,其中包含所有内容(vim、bash、screenrc),在 home 中克隆它并在 home 中创建它们的符号链接;
  • 为每个配置(vim、bash、screenrc、cvsrc 等)创建一个“dotfiles”存储库和一个存储库。这个“dotfiles”存储库将仅将其他存储库作为子模块,但仍然需要在主目录中创建符号链接。

您认为在第二种方法中为每个配置创建一个存储库是否太过分了?您还有其他建议吗?我想在 linux/mac 上使用这种方法。我也在 Windows 上使用 vim,这就是为什么我坚持使用子模块创建不同的存储库 - 在 Windows 中我只会克隆 vim 存储库:主存储库将 vim 作为子模块。

(我使用的是 bitbucket 私人帐户。那里可以有子模块吗?还有一件事:是否可以在 Mercurial 存储库中将 git 子模块作为子模块?如何?)

谢谢!

I've started to put some files in version control in mercurial. It started with .vim, and then with .bashrc, and now I realized a lot of other files could be versioned as well (such as .zshrc, .task directory created by taskwarrior, etc)

Fact is I would like to know which approachs are available and how people here in SO do it.

Versioning home is not a good idea since I would need to edit my .hgignore, and each time a new folder I don't want versioned is added I would need to edit .hgignore as well.

So I think of 2 approaches:

  • Create a "dotfiles" repo with everything inside it (vim, bash, screenrc), clone it in home and create symbolic links in home to them;
  • Create a "dotfiles" repo and a repo for each configuration (vim, bash, screenrc, cvsrc, etc). This "dotfiles" repo will just have the other repositories as submodules, but creation of symbolic links in home is still needed.

Do you think it's overkill to create a repository for each configuration in the second approach? Do you have another suggestions? I would like to use this approach on linux/mac. I use vim on windows as well, that's why I tought of making different repositories with submodules - in windows I would just clone the vim repo: the home repo would have vim as a submodule.

(I'm using a bitbucket private account. Is it possible to have submodules in there? And one more thing: is it possible to have git submodules inside a mercurial repository as submodules as well? How?)

Thanks!

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

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

发布评论

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

评论(3

懷念過去 2024-10-12 08:07:24

我建议创建一个存储库,并将所有点文件硬链接到那里。这样,您将只管理一个存储库,但不必在主目录中的每个文件都有一个 .hgignore。我使用 Dropbox 而不是 Mercurial 来完成此操作,效果非常好。

I would suggest making one repository, and hard linking all of your dotfiles there. This way, you will only be managing one repository, but you don't have to have a .hgignore with every file in your home directory. I do this with Dropbox instead of Mercurial, and it works quite well.

负佳期 2024-10-12 08:07:24

尽管所有答案都很好,但我还是根据自己的解决方案做出了决定。

我将创建两个存储库:vim 和 home(我在不同的操作系统、*nixes 和 windows 中使用 vim,因此值得为此拥有单独的存储库)。 Vim 将成为家里的一个子仓库。

Home 将是一个 dotfiles 文件夹,有一个符号链接所有内容的 bash 脚本,因此我可以克隆我的存储库并运行该脚本。

Although all answers were great, I decided by my own solution.

I'm going to create two repositories: vim and home (I use vim in different operating systems, *nixes and windows, so it's worth having separate repositories for that). Vim is going to be a subrepo in home.

Home is going to be a dotfiles folder, having a bash script that symlinks everything, so I can clone my repo and just run the script.

青春有你 2024-10-12 08:07:23

大多数这样做的人都会在他们的 ~/.hgignore 文件中放入类似的内容:

.*

它会自动忽略一切。然后他们只需 hg add 他们确实想要跟踪的文件 - hg add 覆盖忽略规则(与 CVS/svn 不同)。

需要注意的一件事是,mercurial 不会跟踪文件权限(执行位除外),因此您必须小心 .ssh/authorized_keys 获取所需的 600 以外的权限。像 etckeeper 这样的工具可以自动执行权限(和所有权)处理部分,从而使 hg (或 git )不仅适用于 ~,还适用于 /etc 等系统事物。

Most folks who do this put something like this in their ~/.hgignore file:

.*

which automatically ignores everything. Then they just hg add the files they do want tracked -- hg add overrides ignore rules (unlike in CVS/svn).

One thing to beware of is that mercurial doesn't track file permissions (excepting the execute bit) so you have to be careful of things like .ssh/authorized_keys getting permissions other than the 600 it needs. Tools like etckeeper automate the permissions (and ownership) handling parts of this making hg (or git) suitable for use on not just ~ but also system things like /etc.

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