一个git在不同地方的多个文件夹 [英] One git for multiple folders in differents places

查看:499
本文介绍了一个git在不同地方的多个文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为这个问题之前被问过,但是我没有发现任何有趣的工作。我读过这个我可以存储。文件外git的文件夹,我想跟踪?单的Git在多个地方使用目录进行回购尝试使用它,但没有找到实现这一目标的方法。



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



但是文件的结构看起来像这样一些想法

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

也许解决方案是 init 将存储库设置为/ Users / Jeremy并创建一个大的gitignore,但我认为这不是最好的方式。



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

解决方案

p>如何在一个地方创建一个git仓库来管理所有这些不同的文件夹?


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


vcsh允许您在单个目录中维护多个Git存储库。他们都保持他们的工作树木,而不会互相破坏或干扰。


请参阅管理点文件与VCSH和myrepos 中,和VCSH呈现 GitMinutes#13:理查德哈特曼与VCSH 管理您HOMEDIR


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 ?

解决方案

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"

这篇关于一个git在不同地方的多个文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆