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

前端 未结 8 1844
旧巷少年郎
旧巷少年郎 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 10:53

    This got me thinking, since I would like very much the solution of using a symlinked file/dir but am stuck on a windows computer. As far as I know the symlinks in windows doesnt really work in the same way. So another solution could be to write two scripts/bash functions to "import" and "export" the file(s) in question, such as:

    import() {
        cp -fr /home/some/directory /htdocs/
    }
    
    export() {
        cp -fr /htdocs/directory /home/some/
    }
    

    Then you would have a copy of the file in your repository, which you could git add.

提交回复
热议问题