I store my config files (~/.bashrc
, ~/.emacs
, ~/emacs
, etc.) in git. The way I configured this was simply to add a git repository in the h
I keep my dotfiles in a Git repository like you do—my home dir is a Git repository.
git gui
: I rarely use it, so I'm not really sure how its performance is impacted by lots of untracked files. However, I do have a ~/.gitignore
file that simply contains *
. Perhaps ignoring everything will speed up git gui
for you.
Accidentally adding files: Creating a ~/.gitignore
file that simply contains *
also solves the problem of accidentally adding a file to your dotfiles repository when you forget to initialize a new project repository (it'll tell you to use -f
if you really want to add the file).
I've never had a problem with nested repositories.
Some notes:
The main reason why I set my ~/.gitignore
to *
is so that git status
doesn't show every file in my home directory. It forces me to use git add -f
all the time, which is a bit annoying, but not that big of a deal.
Get in the habit of using git clean -dx
instead of git clean -dxf
. You'll have to remember to run git config clean.requireForce false
in new project repositories, but it'll prevent you from accidentally deleting all of your files in your home directory if you're not in the directory you think you're in.
Git sometimes decides to reset file permissions. This can be bad if you want to keep sensitive files (chmod og-rwx
) in your Git repository. I handle this via a post-checkout
hook that fixes permissions of certain files and directories (e.g., ~/.ssh/authorized_keys
).