0

I have created a git repository on my home directory (/home/user/.git) to "backup" and save alle changes from my dotfiles.

To solve this I have implmeneted a gitignore where I explicit ignore all files excepting the wanted dotfiles.

But know I can access the git repository from everywhere (home/user/folder1, home/userfolder2) - Can I limit the recursivity from a git repository, so only the directory /home/user is under vcs?!

Thanks in advance!

Johannes Sasongko
  • 4,178
  • 23
  • 34
xyNNN
  • 492
  • 3
  • 21
  • http://stackoverflow.com/a/16183043/3001761 – jonrsharpe Sep 05 '15 at 09:08
  • This does not solve my problem. Basically I can enter "git status" in /home/user/folder1 and it shows me the information about the git repository... – xyNNN Sep 05 '15 at 09:29
  • Yes; you're ignoring it, but still within the repo. Have you considered symlinking in your dotfiles from elsewhere? – jonrsharpe Sep 05 '15 at 09:31
  • hmmm, yeah! This should be a solution - not perfect, but it will work! thanks so far. Perhaps someone else have a other solution. – xyNNN Sep 05 '15 at 09:36

1 Answers1

1

Symlinking the dotfile is one solution.
I mentioned before in "One git for multiple folders in differents places" the project vcsh: 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"

That is another approach to trying to have a repo directly in one's $HOME (having to exclude any subfolder).

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    I haven't used vcsh, but I agree with the fundamental mechanism - make your `GIT_DIR` something like `.dotfiles.git` so that you have to be explicit about managing them and you don't accidentally mix up repos. vcsh seems like a reasonable approach to make this easier. – Edward Thomson Sep 05 '15 at 13:49
  • I have choosen the solution with a separate folder for my dotfiles and link it via ln to my $HOME directory. Thanks! – xyNNN Sep 05 '15 at 16:38
  • Another way to manage your dotfiles with symlinks is with GNU stow. check it out. There are lots of examples on Github, i use it to manage my dotfiles and it's great [my dotfiles](https://github.com/aurelien-rainone/dotfiles) – arainone Jan 02 '16 at 01:26