[Git] 로컬브랜치 생성 후, 원격브랜치 연동하기
git 을 사용하여 협업을 하다보면,
새로 브랜치를 따고, 원격 브랜치와 연동하고, 브랜치를 삭제하는 등의 행위를 자주 하게된다.
이를 쉽게 정리해보자
[local branch 생성]
//만들고자 하는 로컬 브랜치 이름을 정하면 된다
$ git branch <branch name>
[생성한 local branch 로 체크아웃]
//방금 생성한 로컬 브랜치로 이동한다
$ git checkout <branch name>
or
$ git switch <branch name>
[local branch 와 remote branch 연동]
//로컬 브랜치가 바라볼 원격 브랜치 이름을 입력해준다
$ git branch --set-upstream-to origin/<branch name>
[local branch 삭제]
// 로컬 브랜치를 삭제한다
$ git branch -d <branch name>
[remote branch 삭제]
// 원격 브랜치를 삭제한다
$ git push origin --delete <branch name>
Git 에 이미 올라간 commit 을 되돌리고 싶다면?
https://devinserengeti.tistory.com/32?category=917422
'[개발 공부] > [Git - 버전관리]' 카테고리의 다른 글
[Git] first commit 하기 & git ignore가 동작하지 않을 때(git cache 삭제) (0) | 2024.05.13 |
---|---|
[Git] cherry-pick: 다른 branch commit 복사해오기 (0) | 2022.05.26 |
[Git] pull 되돌리기 & 원격에 올라간 commit 되돌리기 (0) | 2022.05.26 |
[Git] SSL 에러: SSL certificate problem: unable to get local issuer certificate 3가지 해결방법 (0) | 2022.02.16 |