How dotfiles can save you a lot of time
AlessandroMinoccheri
Posted on March 1, 2021
As a developer, I try to automate and optimize all of my processes and workflow.
Sometimes it’s difficult to understand how you can optimize your work daily life, but for me, one of the best things that can help me a lot is sharing and discussing my ideas, my thoughts, my approaches, and my code with other developers.
Sharing and discussing your leaks with other developers can open your mind to new approaches and fixes.
Every time I try to talk to other developers about a problem, or a doubt, usually, in the end, I feel more conscious about the problem with a new idea in mind to develop.
The discussion can be done asynchronously or synchronously.
For example, a discussion could be synchronous when you are doing pair programming with someone or when you are in a meeting.
For asynchronous discussion, I mean for example: writing your problem in a chat and waiting for an answer from another developer.
Another discussion method could be using pull requests and waiting for other developers that review your code or open a new discussion about it.
All those practices are fine; it depends on the problem and on the team.
But trying to receive feedback about a solution or another point of view about a problem is one of the most important things to do to become better every day.
As a developer usually I work on many projects and sometimes with different machines with different configurations.
I try to understand an efficient way to optimize my work using my configurations wherever I want.
A couple of years ago, while discussing with other developers, I found that many people were sharing their configurations on GitHub.
Inside those repositories, there were configurations, discussions about optimizations, problems solved with bash scripts, and many other useful things.
For this reason, I have created my personal dotfiles repositories, and you can see it here: https://github.com/AlessandroMinoccheri/dotfiles
What is a dotfiles repository?
A dotfiles repository is a set of configurations that can be used, usually, on every Linux or OSX system.
You can change it on your personal computer, or inside a new server and you can always get that repository with your configurations in a few seconds.
My dotfiles repository is evolving day after day because sometimes I fix an issue, I insert a new shortcut, or I install a new useful plugin.
So it’s always in evolution, it depends on what you are using and what is useful for you.
But, pay attention, there are things that you don’t have to commit inside a dotfiles repository like:
passwords
API key
ssh key
…
So don’t commit personal information or secret passwords.
You must commit only things that everyone can see without problems.
My personal dotfiles repository
In my repository I have created some scripts:
./copy_dotfiles.sh
This script is used when you change something inside your shared configuration and you want to commit it into your dotfiles repository.
For example, I copy bash_profile and zsh configurations inside a folder with the same name:
printf “\nCopying profile configuration”
cp ~/.bash_profile bash_profile
printf “\nCopying personal zsh configuration”
cp -rf ~/.zsh/ zsh
After launching the copy script I make a commit with a significant message about the last changes.
Another essential script is:
./install_dotfiles.sh
The script is used when you want to import your configurations inside your actual system.
Example of code inside the script:
printf “\nInstalling profile configuration”
cp -f bash_profile ~/.bash_profile
printf “\nCopying personal zsh configuration”
cp -rf zsh/ ~/.zsh/
In this case, I take directories from my repository and copy those inside the correct path for my system.
Now you can copy and install your configurations whenever and wherever you want.
In my dotfiles repository I have put configurations for:
bash_profile
zsh
nvim
git
oh-my-zsh
As I wrote earlier in this article, sharing and discussing with other people can open your mind to new solutions.
In my case, I optimized a lot of my configurations by reading other dotfiles repositories and asking questions about some things that I couldn’t understand.
Also, it’s a good practice to open issues inside other dotfiles repositories for asking questions, fixing a problem, or asking for clarification.
It’s up to you now, you can create your dotfiles repository and try to share and discuss your configurations with other developers
Please write to me if you have any questions and follow me on Twitter to stay updated with new articles or tips.
Posted on March 1, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.