git: How do you add an external directory to the repository?

前端 未结 8 1848
旧巷少年郎
旧巷少年郎 2020-12-02 10:16

I want to add an external directory to an existing repository.

External Dir: /home/some/directory

Working Dir: /htdocs/.git

If I attempt the followin

8条回答
  •  时光说笑
    2020-12-02 11:14

    If I need to do something like that I would normally move that external file or directory into my git repo and symlink it's original location to the new one.

    mv /home/some/directory /htdocs/directory
    ln -s /htdocs/directory /home/some/
    git add ./directory
    

    I use this technique when I am developing a plug-in for an application that I want to keep under version control but have to store in a specific location.

提交回复
热议问题