0

I keep my .vimrc file in a git repository since I use it on multiple computers. I don't believe there is a way to change the default location of .vimrc, so I keep it at ~/dotfile/.vimrc. I created a symbolic link between these with ln ~/dotfiles/.vimrc ~/.vimrc, which I then confirmed worked with ls -i ~/.vimrc which shows 12345 /Users/TheStrangeQuark/.vimrc and then ls -i ~/dotfiles/vimrc which shows 12345 /Users/TheStrangeQuark/dotfiles/.vimrc.

Now, I pull the latest version of my .vimrc while in ~/dotfiles. Now, the symbolic link is broken, which I can confirm by seeing different inode numbers from ls -i for the two files. I also can see that ~/.vimrc is not the updated version from my git pull.

Is there a way to make it so my git pull won't break this symbolic link?

I am running MacOS Majave if that helps.

TheStrangeQuark
  • 2,257
  • 5
  • 31
  • 58

1 Answers1

1

As mentioned in "Git and hard links", hard links cannot be represented in git, at least not without third party tools, or a post-merge hook.

This differs from soft link (ln -s), which are stored as a file pointing to the destination.

See also "What is the difference between a hard link and a symbolic link?".

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250