What is the proper way to checkout a bunch of .*rc files into a home directory?

I've seen lots of github repos online and people usually name them dotfiles, and I guess they get checked out into their home directory; but what I don't understand is...

How does one keep their other home files (specific to that machine) separate from their .*rc related files?

For instance, you would not want to store /home/<username>/Documents in the dotfiles git repo, but you would want to store .vimrc, /home/vim in the repository.

I'm aware of using .gitignore to ignore files for a repository, but I don't want to add an entry to .gitignore every single time I add a file to /home/<username>/Documents. Is there a way to do this the opposite way, that I only specify the files and directories related to my dotfiles project to be included in the repository?

Also, if I create a new feature branch for something that I'm already developing, and I check it out, I don't want it to "blow away" the non-dotfiles folders etc when I check it out, or have git complain that the working directory isn't clean before cutting a new branch.

Would this somehow require the use of git submodules?

What I'd really like to do with this is be able to get on a new Linux box and with the required dependencies installed check out a common version of my .*rc files and related files from my repo, so if I fix it on one, I can just pull the changes to the other machines.

1 Answer 1


An option is to use symbolic links. For example, say I have my git checkout out in ~/.dotfiles. I might have:

.vimrc      -> ~/.dotfiles/vimrc
.bashrc     -> ~/.dotfiles/bashrc
.bash_login -> ~/.dotfiles/bash_profile

I would not, personally, check my home directory itself into the repo.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.