There are a few unique challenges when it comes to putting your dot files under source control. The naïve solution — just creating a git repository in your home directory — has pitfalls. What are they, and how can we do better?
.gitignore
that ignores everything but the dot files, which can be done, but then there’s another issue….gitignore
in my home directory, and then have a git repository in ~/myrepo
, git commands run in that subdirectory seem to ‘see’ the .gitignore
one level up… and this can cause strange behaviour.The simplest approach I have come across is:
dotfiles
where you’d normally store your git repos. (For me, this is ~/git/dotfiles
).In this example we’ll set up the repository and make an initial commit containing our .bashrc
.
#git #bash #software-development #dotfiles