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

前端 未结 8 1849
旧巷少年郎
旧巷少年郎 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

    If the code that you want to add to your repo is not too big, you could also automatically copy it to your repo each time before you push.

    In my case I for example need one R file, which I modify quite often, in several repos and I wrote a little shell script:

    #!/usr/bin/env bash
    
    cp -r /some/directory/file.R .
    git add .
    git commit -m "add"
    git push
    

    ...and I run this script in order to push all changes, including the ones in /some/directory.

提交回复
热议问题