Git을 사용하면서 다른 저장소에 있는 파일을 그대로 나의 프로젝트에 사용하고 싶은 일이 있었다.
이런 경우에는 submodule과 심볼릭 링크를 사용하면 되었다.
$ git submodule add https://github.com/hijae/open-fuji-recipes-profiles
$ ln -s hijae/open-fuji-recipes-profiles/makeFP.py
$ git add .gitmodules makeFP.py
$ git commit -m "add a symbolic link to makeFP.py with the respective submodule"
위와 같이 Git에 서브모듈을 설정하고 원하는 파일을 심볼릭 링크로 지정한 후 커밋하면 된다.
혹시나 clone을 받아왔을때 동작하지 않으면 서브모듈을 업데이트 하면 해결된다.
$ git submodule init && git submodule update
git: symlink/reference to a file in an external repository
Is it possible in git to have a "link" to a particular file in a git repo? Like what git submodules do for folders but my question is about a particular file, not a full directory: my-project/
stackoverflow.com
'개발' 카테고리의 다른 글
| 스크립트는 실행하기 전에 반드시 권한을 주자 (0) | 2023.02.23 |
|---|