본문 바로가기
Git

[Git] branch 명령어

by diaryDev 2024. 8. 5.
728x90

local branch 조회

git branch

 

remote branch 조회

git branch -r

 

전체 목록(local, remote) 보기

git branch -a

 

branch 이동

git checkout [브랜치 이름]

 

branch 생성

git checkout -b [브랜치 이름]

git branch [브랜치 이름]

 

이전 branch로 돌아가기

git checkout -

 

local branch 삭제

git branch -d [브런치 이름]

 

remote branch 삭제

git push origin --delete [브랜치 이름]

 

merge

git merge [브랜치 이름]

 

merge 취소

git merge --abort

 

local branch 이름 변경

git branch -m [old name] [new name]

 

 

원격저장소(remote) branch명 변경

# old name branch 삭제했다는 것을 push
git push origin :[old name]

# 이름 바꾼 branch push
git push --set-upstream origin [new name]

 

728x90

'Git' 카테고리의 다른 글

[GitHub] private repository commit 잔디 보이게하는 방법  (0) 2024.08.14
[Git] 강제 push  (0) 2024.07.09