Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to git a folder outside the repository?

Tags:

git

ln

I have a git repository sitting as ~/a.

At the same time, I have some stuff from ~/b/content/data/, which will be updated by another application.

For backup purposes, I would like to add ~/b/content/data/'s stuff into git ~/a, without moving the folder. And also, of course, without manual copy.

Can I do that? Is it via ln?

like image 271
Jane Foster Avatar asked Oct 19 '22 22:10

Jane Foster


1 Answers

Adding symlinked directories worked until git 1.6.1. Now you have other options.

  • You can make hardlinks for the individual files you want to store, if you know them or they are only few.
  • You can put the actual data into the repository and make ~/b/content/data/ a symlink.
  • You can use sudo mount --bind SOURCEDIRECTORY TARGETDIRECTORY instead of a link.
like image 87
user2291758 Avatar answered Oct 22 '22 20:10

user2291758