Git

[GitHub] Remote Tracking Branches

SangRok Jung 2022. 12. 28. 00:37
반응형

Remote Tracking Branches


원격 추적 브랜치

마지막으로 원격 저장소와 통신한 시간을 기억하는 포인터

remote/branch 로 표기

main branch에서 n commit을 할 수 록 origin/main에서 n commit 멀어진다.

push할 시 최신상태가 반영된다.

 

 

 

git branch -r

원격 추적 브랜치를 확인한다.

git branch -r

 

 

 

git checkout

해당 상태를 참조한다.

다시 돌아 올때는 git switch branch.

git checkout remote/branch

# origin/main 상태를 참조한다.
git checkout origin/main

 

 

 

 

git swtich

로컬에서 원격 브랜치들로 작업을 할 때 사용.

해당 로컬 브랜치를 생성하며 자동으로 리모트 브랜치를 추척하도록 설정한다.

git switch branch

 

반응형

'Git' 카테고리의 다른 글

[GitHub] Adding Collaborators  (0) 2022.12.28
[GitHub] Fetching & pulling  (0) 2022.12.28
[GitHub] Existing Repo  (0) 2022.12.28
[GitHub] SSH Keys  (0) 2022.12.28
[Git] Cloning  (0) 2022.12.28