Do you have a dotfiles repository?

spO0q πŸ’ - Apr 6 '22 - - Dev Community

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 -
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player