IT/Git

Git Branch 사용법

상쾌한기분 2021. 2. 17. 14:06
728x90
반응형

Git Branch 사용법

Jetbrain IDE를 사용합니다

1. branch 확인하기

 

git branch

현재 master branch 만 존재, *는 현재 활성화 branch 표시

git branch -r

원격 저장소 branch 확인

 

2. branch 생성 및 이동

첫번째 방법

git branch feature/#1

git branch

git checkout feature/#1

 

두번째 방법

git checkout -b feature/#1

 

 

3. branch 삭제

git branch -d feature/#1

 

4. branch Github 원격 저장소 push 

git push --set-upstream origin feature/#1

혹은

git push -u origin feature/#1

로컬에만 feature/#1 branch 존재하고 원격 저장소에 생성되도록 해야한다.
최초의 push는 --set-upstream 명령어 옵션을 주어야 에러가 발생하지 않는다.

728x90
반응형