붉은거위 노트 (redgoose note)

git Notes

Nest
Development
Category
git
Hit
568
Star
0

[GIT] Submodule (Nested Repository) 사용하기

저장소 중첩에 관한 방법 중 하나

http://tuwlab.com/ece/26011

git subtree를 사용하여 재사용할 코드 독립 시키기

저장소 중첩에 관한 방법 중 하나

http://tuwlab.com/ece/26011

global .gitignore 설정하기

전역으로 .gitignore 설정해야할 일도 생긴다. 그래서 다음과 같이 전역으로 git commit을 제외할 수 있다.

먼저 제외할 파일을 편집한다.

nano ~/.gitignore

다음과 같이 global config로 설정한다.

git config --global core.excludesFile ~/.gitignore

출처: https://gist.github.com/subfuzion/db7f57fff2fb6998a16c

GIT 과정

  1. 저장소 만들기
    git init
  2. 저장소 받아오기
    git clone 저장소주소
  3. 인덱스 추가
    git add <파일이름>
    git add *
  4. 커밋하기
    git commit -m “확정본에 관한 설명”
  5. 내용 발행하기
    원격서버 주소를 git에게 알리기
    git remote add origin <원격서버주소>
    원격서버로 올리기
    git push origin master

submodule 저장소들 전부 업데이트하기

git submodule foreach git pull origin main

submodule 로 사용하는 자식 저장소 가져오기

서브모듈이 있는 상태에서 저장소를 클로닝 받으면 서브모듈쪽 저장소가 비어있는 상태일 수 있는데 다음과 같이 소스코드를 받아올 수 있다.

git submodule init
git submodule update --remote --merge