기록하는 개발자

[Git] git의 branch 관련 명령어(생성, 이동, push etc) 본문

Git

[Git] git의 branch 관련 명령어(생성, 이동, push etc)

밍맹030 2023. 6. 9. 17:26
728x90

Branch 생성

git branch 브랜치명

 

Branch 이동

※ git 2.23버전 부터 git 의 checkout이 switchrestore로 대체되었다.

 

 checkout: Switch branches or restore working tree files

 switch: Switch branches
 restore: Restore working tree files

 

Git 변경사항 복원

git restore 

 

Branch 생성 및 변경(이동)

git switch -c 브랜치명

 

Branch 삭제

git branch -d 브랜치명

 

Branch 강제 삭제

git branch -D 브랜치명

 

Branch 최초 push

git push --set-upstream origin 브랜치명

 

특정 브랜치로부터 pull

git pull origin 브랜치명 

 

최초에 한 번 위와 같이 push 하고 나면 이후에는 아래와 같이 push 가능

git push -u origin 브랜치명

728x90