Adding your .vim ~/.vimrc to github (aka dot files)

John Tomson picture John Tomson · Aug 13, 2013 · Viewed 20.5k times · Source

I have seen a few people that have git repos with their dot files. I'm wondering if they just

cd ~/
git init
git add .vimrc
// etc

? And then that's how they keep it up to date? Or do they probably make copies and sync them?

What strategy do you guys recommend or use? Mostly don't wanna commit and push my entire ~/

Thanks

Answer

sitaktif picture sitaktif · Aug 13, 2013

Making a git repository of your home is probably a bad idea (you would be spending more time creating your .gitignore file than on doing what you really want to do).

I suggest using a separate git directory for your dotfiles (eg. ~/git/dotfiles) and them making symlinks to your home (eg. ln -s ~/git/dotfiles/.vim ~/.vim, etc.).

If you can't be bothered creating symlinks manually each time you want to install your dotfiles somewhere, you can use a script like the following one: https://github.com/gibfahn/dot/blob/master/link.