我想这个主题之前有人问过,但我没有发现任何有趣的事情。我读了这个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/