1

I am trying to share a config file ~/.spacemacs in a git repository ~/repo/config/spacemacs.

Since I am on osx, I installed hardlink and used it like :

➜  ~  hln ~/.spacemacs ~/repo/config/spacemacs

The end goal is to be able to edit the file in both place.

A simple link seems to work when editing it simply.

ln ~/.spacemacs ~/repo/config/spacemacs

But then a git stash will only work on the repository. But to commit it to git. What am I missing ?

  • 1
    Did you try to put the "original" file in the git repository and to do a symbolic link out (ln -s git/path/file other/place/file )? – Hastur Mar 4 '16 at 10:06
  • @Hastur I did the reverse. It works now, although I thought I tried the simple link first. Thanks. – nha Mar 4 '16 at 10:07
  • 1
    Ops now I see you answer... I write in the middle. There is not a simple link in Linux/BSD. There are hard and symbolic.With different way to act. As often there are many ways to solve a single task. Ps> BTW I think you can post question and answer at the same time... – Hastur Mar 4 '16 at 10:10
  • @Hastur Yes of course. I am deleting my answer. Seems like editing works but git stash breaks it. – nha Mar 4 '16 at 10:12
  • 1
    Let me know (with a comment) if it works what proposed above... the original file in the git repository and the link outside. With a simple ln -s :-) – Hastur Mar 4 '16 at 10:14
1

I think the most simple way is to put the original file in the git repository and to do a symbolic (or hard) link from outside.

ln -s git/path/file other/place/file 

One of the many sources about the differences between hard and symbolic links [1].

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.