Want
I wanna manage nvim config by git.
Problem
Link is break by git checkout .
command. Expect behavior is overwrite my nvim config with remote repository source. But actual behavior is overwrite link with remote repository source.
Code
I was tried as bellow code.
# clone
cd ~/Documents/GitHub/
git clone https://github.com/ShortArrow/my-nvim-config
cd my-nvim-config
# delete "./nvim" for making link
rm -r ./nvim
# making link
ln -s ~/.config/nvim/ ./nvim
# if you need, "cp ~/.config/nvim/ ~/.config/nvim-backup"
# I wanna rewrite nvim config by git with this command
git checkout .
Already Tried
try1
sudo git config --system --unset core.symlinks
git config --local core.symlinks false
try2
$> sudo ln -d ~/.config/nvim/ ./nvim
ln: failed to create hard link './nvim' => '/home/who/.config/nvim/': Operation not permitted
On Windows
This github repository is working good with Junction link on Windows.
CodePudding user response:
A softlink is just a file with the target path in it (and a permission flag telling the OS to treat it as a link), and Git is treating it as such.
Instead of changing what is in the repository by changing the repository file into a link to the config file, link the other way: make the config file link into the repository.