Search code examples
gitdotfiles

Limit recursivity of a git repository


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!


Solution

  • 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).