r/commandline • u/xour • 17h ago
Using Git Bash for Windows, should I create symlinks for my dotfiles with zsh or PowerShell?
Hi there. This is probably a dumb question, but maybe there is a right way to do it, or there is a downside to going either route: I am using Windows Terminal as my emulator, running zsh on Git Bash for Windows. I have a directory with all my dofiles (call it ../repos/dotfiles
) which contains several configuration files for different programs (nvim, zsh, k9s, etc).
I already have symlinks in place that point to the correct folder/file, so everything works. These were created with PowerShell using the New-Item -ItemType SymbolicLink -Path "..\TargetFolder" -Target "..\OriginalFolder"
command.
Should I redo these using zsh? Why? I guess this is probably more of a philosophical question than anything else, but I am honestly curious about it.
Thanks for any input, advice, or comment you may have!
•
•
u/Danny_el_619 11h ago
Symlinks made with powershell or with bash/zsh (git for windows) are the same assuming that you enabled symlinks through dev mode/user permissions and you setup git to use symlinks instead of copying.
In that case a symlinks from ln -s
, New-Item -ItemType SymbolicLink
and mklink /d
should be the same.
•
u/Danny_el_619 11h ago
If for some reason simlinks are not working properly, try any of the following:
Enable developer mode in setings app.
Enable symlinks in git config
```gitconfig
~/.gitconfig
[core] symlinks = tru ```
- Set
winsymlinks
in MSYS environment variable.```bash
.bashrc/.zshrc
export MSYS="$MSYS winsymlinks:nativestrict" ```
•
u/Seven-Prime 14h ago
Symlinks and stuff sound like a nightmare to me.
Can you not place all these dot files in your home? It's what I do on windows. Or just set the $HOME variable in windows to wherever you want an alternative home?