본문 바로가기

■ 프로그래밍/Front-end

Git & GitHub (3) - branch

git remote add origin https://github.com/계정/repo

브랜치 관리는 git에서 필수이다. 

만들 것이 있다면 해당 브랜치를 새로 만들고, push 후 merge가 끝났다면 해당 브랜치는 삭제하고 다시 새로 브랜치를 생성하여 사용하는 것이 좋다. 

 

Git에서는 local 브랜치와 remote 브랜치로 나뉠 수 있다. 

사용이 완료된 브랜치는 삭제 할 때 두 가지 브랜치 모두 삭제하는 것이 혼선을 방지할 수 있다. 

 

 

브랜치 생성

git checkout feature/브랜치명

 

 

브랜치 삭제

git branch --delete feature/브랜치명

local 브랜치를 삭제하고, remote 브랜치를 삭제하기 위해 한번 push해 준다.

git push origin :feature/브랜치명

 

 

기존 repo remote 제거

git remote remove origin

 

새 repo remote 추가

git remote add origin https://github.com/계정/repo