티스토리 뷰

git

git branch 깃 브랜치 생성 삭제

owal_returns 2020. 6. 24. 12:20

로컬 브랜치 생성하기

$ git checkout -b <브랜치이름>

 

원격 (remote )브랜치 생성하기

$ git push origin <브랜치이름>

origin은 따로 설정한 리모트 저장소 이름이 있다면 대체

 

원격 브랜치 트래킹

$ git branch -u <저장소이름>/<브랜치이름>

-u옵션 대신 --set-upstream-to로 해도됨

 

로컬 브랜치 삭제

$ git branch -d 브랜치 이름

다른 브랜치로 이동(checkout)해서 삭제해야함.

 

 

원격 브런치삭제

$ git push <원격브랜치이름> --delete <브랜치이름>

 

또는

$ git push <원격브랜치이름> :<브랜치이름>

 

```

git-branch - List, create, or delete branches
git branch명령어에 자세히 알고 싶다면 아래링크참조
https://git-scm.com/docs/git-branch

```