问题
I think this subject was asked before, but I didn't find anything interesting to work with. I read this Can I store the .git folder outside the files I want tracked? and Single Git repo with directories in multiple locations try to play with it, but didn't find the way to achieve this well.
The goal of this, is to store backup preferences for applications and dotfiles.
But the strucuture of files look to somethink like this
-- /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
Maybe the solution is to init
the repository to "/Users/Jeremy" and make a big gitignore, but I think it's not the best way to do it.
So how can I create only one git repository on one place to manage all this different folders ?
回答1:
how can I create only one git repository on one place to manage all this different folders ?
That is what the project vcsh is for: one git repo for your different configs, but:
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.
See an example in "Managing dot-files with vcsh and myrepos", and vcsh presentation in "GitMinutes #13: Richard Hartmann on Managing Your Homedir with vcsh"
来源:https://stackoverflow.com/questions/24251873/one-git-for-multiple-folders-in-differents-places