git - 一个 git 用于不同位置的多个文件夹

标签 git repository dotfiles

我想这个主题之前有人问过,但我没有发现任何有趣的事情。我读了这个Can I store the .git folder outside the files I want tracked?Single Git repo with directories in multiple locations尝试使用它,但没有找到实现这一目标的方法。

这样做的目的是存储应用程序和点文件的备份首选项。

但是文件的结构看起来像这样

-- /Users/Jeremy/Library/Application\ Support/Sublime\ Text\ 3/Packages/User
------ Theme
------ Snippet
------ Preferences.sublime-settings
--
-- /Users/Jeremy/.gitconfig
--
-- /Users/Jeremy/.config/fish
------ config.fish
------ fish_history

也许解决方案是将存储库初始化到“/Users/Jeremy”并制作一个大的gitignore,但我认为这不是最好的方法。

那么我怎样才能在一个地方只创建一个 git 存储库来管理所有这些不同的文件夹呢?

最佳答案

how can I create only one git repository on one place to manage all this different folders ?

这就是project vcsh适用于:一个用于不同配置的 git repo,但是:

vcsh allows you to maintain several Git repositories in one single directory. They all maintain their working trees without clobbering each other or interfering otherwise.

请参阅“Managing dot-files with vcsh and myrepos”中的示例,以及“GitMinutes #13: Richard Hartmann on Managing Your Homedir with vcsh”中的 vcsh 演示

关于git - 一个 git 用于不同位置的多个文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24251873/

相关文章:

intellij-idea - 我应该将哪些 IntelliJ 配置文件保存在我的点文件中?

ruby-on-rails - 在 Gemfile 和 .ruby-version Dotfile 中列出 Ruby 版本是一种不好的做法吗?

git - 如何配置 emacs.app 以在 *shell* 中使用 git for OSX 上的 git

Svn 日志 - svn : '.' is not a working copy

git - 无法将大型仓库从 gitlab 迁移到 github

python - 构建 XML 文档结构图

git - 切换到 hg-flow 模型 : how to rebase commits and branches

git - 使用 Git 更改项目的第一次提交?

git - 如何从终端或命令行创建 gitlab 项目

Git pull with rebase 导致过度冲突。我怎样才能修复我们的工作流程?