Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git tracking dotfiles (example: .zshrc)

Tags:

git

bash

zsh

On my mac at the root I have my .bashrc, .aliases, .zshrc..., then in another folder down the way I have a git repository of the same dotfiles. When I update the ones at the root, I update the git repo as well (manually). Is there some way to 'link' the dot files that are actually implemented at the root folder to the git repo so I only have to deal with one change?

like image 372
Alexander Joseph Norton Avatar asked May 31 '26 01:05

Alexander Joseph Norton


1 Answers

What about symbolic link?

Just delete the file in your root, and recreate them as

ln -s /physical/path/to/file /symbolic/link/path

For example, if you have the file /git/.aliases, ln -s /git/.aliases /root/.aliases will create a symbolic link called .aliases in the root folder. From this point on, whichever file you modify (/git or /root) will modify the other one as well.

Have a look at this link for more details on symbolic links and Mac.

Please, forgive me for the random paths, I am not a Mac users.

like image 191
ThanksForAllTheFish Avatar answered Jun 01 '26 23:06

ThanksForAllTheFish



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!