I just put my dotfiles in a repository in the manner suggested by Eli Barzilay here:
So I’ve finally found a solution that takes the best of both: put the repo in a subdirectory, and instead of symlinks, add a configuration option for “core.worktree” to be your home directory. Now when you’re in your home directory you’re not in a git repo (so the first problem is gone), and you don’t need to deal with fragile symlinks as in the second case. You still have the minor hassle of excluding paths that you don’t want versioned (eg, the “*” in “.git/info/exclude” trick), but that’s not new.
My .git/info/exclude looks like this:
*
.*.swp
*~
\#*#
.DS_Store
The *
on the first line successfully ignores all files, so I add things explicitly with git add -f
. However, this has the side effect that files I want ignored slip through.
Is there a way to tell git to really ignore certain files, even though I use add -f
?