Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
April 6, 2022 11:19 am GMT

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 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 maurytarget="$PWD/files"echo "Copying files..."cd $targetfor entry in $(ls .??*)do  cp $entry $HOME  echo "$entry copied!"doneecho "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.


Original Link: https://dev.to/jmau111/do-you-have-a-dotfiles-repository-27fk

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To