One git for multiple folders in differents places

倾然丶 夕夏残阳落幕 提交于 2020-01-02 13:05:07

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!