dotfiles, .config
GuideDotfiles
August 8th, 2023

My dotfiles are available at my github.

🤔 What is a dotfile?


Dotfiles, those files starting with a dot in their names, hold the secret to personalizing and refining your system. These configuration files, like .bashrc or .vimrc, represent the identity of your customized computing environment.

Dotfiles empower users to customize their tools and applications according to their preferences. Whether it's adjusting the appearance of the command prompt, enhancing the capabilities of a text editor, or tuning version control settings, dotfiles provide a platform for modifications.

Sharing dotfiles has become a tradition among tech enthusiasts—an opportunity to exhibit configurations, shortcuts, and optimizations that boost productivity. By copying dotfiles, users can replicate a crafted setup on any machine, ensuring a consistent computing experience throughout.

❓ How to manage dotfiles?


I have been searching for a way to manage my dotfiles through the internet, and I read about the bare git repo technique on the Atlassian website. In this article, they are mentioning the bare git repo technique to manage dotfiles, which I find very convenient. For managing your dotfiles using the bare git repository, you have to go through the following steps:

  • Create a Git bare repository at ~/.dotfiles to track configuration changes.
git init --bare $HOME/.dotfiles
  • Set up an alias named 'config' to replace the standard 'git' command for configuration interactions.
alias config='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
  • Apply a local repository flag to hide untracked files, ensuring a cleaner display when using 'config status' and similar commands.
config config --local status.showUntrackedFiles no
  • Optionally, append the provided alias definition to your .bashrc for easy access to the 'config' command.
echo "alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'" >> $HOME/.bashrc
  • Once you've completed the setup, you can easily version any file within your $HOME folder using standard commands. Simply replace the typical git commands with your custom configuration alias, like so:
config status
config add .vimrc
config commit -m "Add vimrc"
config add .bashrc
config commit -m "Add bashrc"
  • Add a remote named 'origin' to your Git bare repository.
config remote add origin <remote_repository_url>
  • Verify the remote has been added successfully.
config remote -v
  • Push the changes to the remote repository (e.g., GitHub).
config push -u origin master
  • You can also create different branches and check them out as needed when you want to change the theme. Check out the preview video here.
config branch
config checkout mocha
config checkout dark

✨ Mocha config

These configuration files are available here.

preview1 preview2 preview3 preview4

✨ Dark config

These configuration files are available here.

preview1 preview2 preview3 preview4