Do you have a dotfiles repository?

As dev, it’s not uncommon to use different machines or to renew laptops and devices. You don’t want to spend too much time in repetitive operations, such as setting git, defining custom aliases, etc.

To speed up install, you can store these configurat…


This content originally appeared on DEV Community and was authored by Julien Maury

As dev, it's not uncommon to use different machines or to renew laptops and devices. You don't want to spend too much time in repetitive operations, such as setting git, defining custom aliases, etc.

To speed up install, you can store these configurations in a git repository (often called dotfiles by convention).

In such repository, you will likely add .bashrc, .zshrc, .gitconfig, .gitignore_global, etc. It's way more convenient for new install and maintenance.

In addition, you may include a small script to copy each file at the root of the $HOME folder, so you won't have to do it manually:

#!/usr/bin/env zsh
# Credit: Julien maury

target="$PWD/files"

echo "Copying files..."
cd $target
for entry in $(ls .??*)
do
  cp $entry $HOME
  echo "$entry copied!"
done
echo "Done!"
cd -

The script goes at the root of the repository and all dotfiles in a subfolder called files:

├── files
│   ├── .bashrc
│   ├── .zshrc
│   ├── .gitconfig_global
│   └── .gitconfig
└── install.zsh

To use the repo, you may run git clone DOTFILES_REPO_URL && cd DOTFILES_REPO && zsh install.zsh.

This approach works best if you keep the same operating system, so you might encounter some issues when switching between Windows, Linux, and Mac, but those incompatibilities tend to be less and less frequent.


This content originally appeared on DEV Community and was authored by Julien Maury


Print Share Comment Cite Upload Translate Updates
APA

Julien Maury | Sciencx (2022-04-06T11:19:42+00:00) Do you have a dotfiles repository?. Retrieved from https://www.scien.cx/2022/04/06/do-you-have-a-dotfiles-repository/

MLA
" » Do you have a dotfiles repository?." Julien Maury | Sciencx - Wednesday April 6, 2022, https://www.scien.cx/2022/04/06/do-you-have-a-dotfiles-repository/
HARVARD
Julien Maury | Sciencx Wednesday April 6, 2022 » Do you have a dotfiles repository?., viewed ,<https://www.scien.cx/2022/04/06/do-you-have-a-dotfiles-repository/>
VANCOUVER
Julien Maury | Sciencx - » Do you have a dotfiles repository?. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/04/06/do-you-have-a-dotfiles-repository/
CHICAGO
" » Do you have a dotfiles repository?." Julien Maury | Sciencx - Accessed . https://www.scien.cx/2022/04/06/do-you-have-a-dotfiles-repository/
IEEE
" » Do you have a dotfiles repository?." Julien Maury | Sciencx [Online]. Available: https://www.scien.cx/2022/04/06/do-you-have-a-dotfiles-repository/. [Accessed: ]
rf:citation
» Do you have a dotfiles repository? | Julien Maury | Sciencx | https://www.scien.cx/2022/04/06/do-you-have-a-dotfiles-repository/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.