Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
730 views
in Technique[技术] by (71.8m points)

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...