git branch 관리

ever.d·2023년 1월 3일
0

STUDY

목록 보기
6/7

git branch 생성

git clone git주소
git branch 로컬브랜치명
git push origin 로컬브랜치명
git branch -a (다 만들어졌는지 확인)
git branch --set-upstream-to=origin/로컬브랜치명 로컬브랜치명

git branch로 pr (pull request)

현재 staging 브랜치에 작업물이 있고
신규 기능을 개발한 소스를 get-count 라는 이름의 branch에 담는다고 가정한다.
이 작업물을 staging branch로 pr을 날린다.

git checkout -b get-count (새로운 로컬 브랜치 생성하면서 해당 브랜치로 checkout)
git add .
git commit -m "Feature / 미 생성된 목록의 개수 구하는 로직 구현" (커밋 메시지를 자유롭게 입력한다.)
git push --set-upstream origin get-count (로컬 브랜치와 같은 원격 브랜치에 소스를 Push 한다.)

pr은 source tree에서 원격 브랜치 -> 마우스 우 클릭하여 pull request를 할 수도 있고
bitbucket 등에 직접 접속해서 pull request를 날릴 수도 있다.

git branch 변경

git branch
git checkout 이동할 branch명

git branch 삭제

git -D 브랜치명

git 관련 에러❗️

error 1)

error : The following untracked working tree files would be overwritten by merge:
Please move or remove them before you merge

untracked 되는 파일이 있다는 것이다. git이 관리해주고 있지 않은 상태이므로 tracked 상태가 되도록 하자.

git add .
git stash
git pull

git stash pop


-- 지속적으로 업데이트 예정

profile
developer / not moving for fortune, only aiming for clear sense of purpose. That's all.

0개의 댓글