User dotfiles for cross-machine compatibility and backup.
This approach comes from this blog post by Anand Iyer.
The default branch has been changed from master
to main
. If you try to pull, it will fail.
To update your local setup accordingly, do the following:
git checkout master # Switch to local master branch
git branch -m master main # Rename the branch to main
git fetch # git latest commits and branches
git branch --unset-upstream # Remove tracking connection to origin/master
git branch -u origin/main # Make new tracking connection to origin/main
Source: Tower
- This is set up for ZSH. In particular, I use the Powerlevel10k theme (installed through https://ohmyz.sh/).
- My ZSH theme configuration uses icons from Nerd Fonts. I'm using the font Hack, but any Nerd Font from this repository should work.
- The
.zshrc
file already creates the alias for using thedotfiles
syntax shorthand described below.
This version avoids issues with conflicts with existing default config files.
Clone into a new (temporary) subdirectory:
git clone --separate-git-dir=$HOME/.dotfiles https://github.com/jtebert/dotfiles.git tmpdotfiles
Move the contents into your home folder:
rsync --recursive --verbose --exclude '.git' tmpdotfiles/ $HOME/
Delete the temporary folder:
rm -r tmpdotfiles
You now have a git repository that you can see from anywhere, aliased to dotfiles
. So you use the same syntax as git
, but you replace git
with dotfiles
. For example:
# Add a file to the dotfiles repository
dotfiles add .bashrc
# See changes (this won't show unadded files, or it would contain your whole home folder)
dotfiles status
# Commit changes
dotfiles commit -m "Add bash config"
# Push changes
dotfiles push