Managing dotfiles in git
As I continue my attempt to learn vim, I thought it was also time to put my common dotfiles in git so it is easier to transfer the configuration from machine to machine.
There is already an excellent resource on using dotfiles with git(hub) but after going through most of the links I was suffering from major information overload so decided to base my own dotfile git config mainly on this one by paulmillr. The basic idea is you have your dotfiles outside your profile root and symlink them in. This is the bash script I'm using to do this (note: it does overwrite existing files):
The dotfiles repo also takes advantage of submodules to pull in vim plugins. This is my first experience of submodules but for this basic usage they seem fine. A couple of things to remember though are a) you need to use the
--recursive flag when cloning to pull through the submodules. If you forget to do this and pull through the repo on a new machine, you need to run
git submodule update --init --recursive. New submodules need to be added from the root of the git repo:
git submodule add <repo-url> <repo location>.
The dotfiles themselves are all basic for now:
.bash_aliases - loads up my alias. There are not too many for now but I plan to add them manually as and when I require them rather than import a long list I never use
.bash_profile - is the default Debian one
.bash_prompt - outputs the prompt with the current user and hot, the working directory, and if a git branch exists, the name of it and whether there are any changes
.bash_rc - is essentially the default Debian one with a few bits removed that are now loaded in else where
.gitconfig - git config and aliases
.gitignore - global git ignores
.vimrc - my newbie-level vim config
Future things to do include adding more Mac OSX specific bits and pieces and looking at the possiblility of merging in sensitive stuff from a private repo.
Here's some other resources I found which are useful reads whilst looking at this: