-
브랜치 가져오기 전에 git remote 갱신해주면 좋다
git remote update
Branch 확인 (git branch) 로컬 브랜치 확인, remote 브랜치 확인하려면 -r 옵션, 다 보려면 -a 옵션을 붙여준다
git branch git branch -r git branch -a
Branch 생성 (git branch) 1번째는 생성하려는 브랜치명, 2번째는 분기해 나올 브랜치명
git branch <생성브랜치명> git branch <생성브랜치명> <분기할 브랜치명> git branch feat/1 develop
생성한 Branch 를 remote 저장소에도 push 해줘야 한다 (연동)
git push <remote 저장소 단축이름> <브랜치명> git push origin feat/1
Branch 이동 (checkout)
git checkout feat/1
Branch 삭제 (-d 옵션) 삭제 전에 다른 브랜치로 옮기고 삭제한다, remote 에 삭제하려면 또 push 해줘야 한다
git branch -d feat/1 git push origin feat/1
바로 remote branch 를 삭제하려면 --delete 옵션을 주면서 push origin 해버린다
git push origin --delete feat/1
Branch 명 변경 (-m)
git branch -m <기존 브랜치명> <새로운 브랜치명> git branch -m fet/1 feat/1
The branch 'feat/1' has no upstream branch. Would you like to publish this branch? 현재 feat/1 브랜치는 로컬에만 있으니 remote 에 발행할까? Yes
참고
'프로그래밍 > Git' 카테고리의 다른 글
Git 최초 연동 / Clone / 권한 주기 (0) 2021.07.17 Remote 저장소 (0) 2021.04.13 파일이름 변경 / 대소문자 변경 인식 (0) 2020.12.24 commit, push 취소 / init 취소 (0) 2020.12.23 github pages 배포 (0) 2020.09.30