머신러닝과 기술적 분석

Git subtree 사용방법 본문

Git

Git subtree 사용방법

BetterToday 2017. 10. 25. 20:47
728x90

1. 다른 project를 가져와서 main project의 subdirectory 에 반영

git remote add sub https://github.com/penny4860/Vehicle-Detection
git subtree add --prefix=subprojects/sub --squash sub master

  • sub project의 history를 유지한 상태에서 merge 하고 싶으면 --squash 옵션은 생략한다.
  • git staging area 가 clean 상태가 아니면 안된다. git staging area를 clean 상태로 만들고, git checkout 을 다시해보자.

2. main project에서의 수정사항을 sub project에 반영

git subtree push --prefix=subprojects/sub sub from-main-project

  • 이렇게 하면 subproject의 remote repo에 from-main-project 이라는 이름의 branch로 push 된다.

3. sub project의 update 내용을 main project에 반영

git subtree pull --prefix=subprojects/sub sub master

728x90
반응형
Comments