본문 바로가기
프로그래밍/git

(git branch) 브랜치 추가 옵션 4가지 (--create-reflog, --track, --set-upstream-to, --unset-upstream)

by 워킹독 2023. 5. 24.
728x90
  1. git branch --create-reflog : 브랜치의 참조 로그(reflog)를 생성
    • 브랜치에서 수행한 모든 작업의 기록을 보관하는데 사용
    • git branch --create-reflog
  2. git branch --track <remote-branch> <local-branch> : 로컬 브랜치를 원격 브랜치와 연동
    • 원격 브랜치의 변경 내용을 추적하고 업데이트할 수 있음
    • git branch --track origin/feature-branch feature-branch
  3. git branch --set-upstream-to=<remote-branch> <local-branch> : 로컬 브랜치를 특정 원격 브랜치와 연결
    • git push와 git pull 명령에서 기본 업스트림(upstream) 브랜치로 설정
    • git branch --set-upstream-to=origin/feature-branch feature-branch
  4. git branch --unset-upstream <branch-name> : 로컬 브랜치의 업스트림 설정을 제거
    • git branch --unset-upstream feature-branch

 

위의 예시를 통해 git branch 명령어의 추가적인 옵션 사용법을 확인할 수 있습니다.

각 옵션은 특정 기능에 사용되며, 상황에 맞게 활용할 수 있습니다.

 

728x90
반응형

댓글