3

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 ?

Community
  • 1
  • 1
jeremybarbet
  • 890
  • 1
  • 15
  • 28
  • 1
    That reminds me of http://blog.tfnico.com/2014/03/managing-dot-files-with-vcsh-and-myrepos.html and vcsh https://github.com/RichiH/vcsh (multiple Git repositories in $HOME). It was presented extensively at http://episodes.gitminutes.com/2013/06/gitminutes-13-richard-hartmann-on.html – VonC Jun 16 '14 at 20:55
  • I will take a look to this. – jeremybarbet Jun 16 '14 at 21:41
  • 1
    Maybe instead of blacklisting, whitelisting folders in your gitignore? http://stackoverflow.com/questions/15288712/gitignore-whitelist-on-directory-and-its-contents – kevin Jun 18 '14 at 02:10
  • Ok, I tried this solution as well, I make some test with the `.gitignore` add all my files from `~/.config` folder, something went wrong, and hop loose all my files. That's so bad :D – jeremybarbet Jun 18 '14 at 08:10
  • 1
    another similar idea to vcsh but a different implementation is multigit (https://github.com/capr/multigit) which is actually used as a git-based package manager –  Apr 15 '15 at 05:49

1 Answers1

2

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"

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • This isn't the opposite of what I want to do ? Several Git repositories in one single directory whereas I want to track several directories with the same Git repository ? – jeremybarbet Jun 17 '14 at 11:01
  • @jbr I agree, but from the presentation his author gave in GitMinutes,that seemed actually a better solution. – VonC Jun 17 '14 at 11:04