DevOps/Github

[GitHub] Github 브랜치 생성, Pull Request

jjuya 개발 기록 2024. 5. 5. 20:03

git repository 생성

 

 

로컬에 내 폴더 프로그램으로 열기 + 터미널 열기

//초기화
$ git init
//git repository랑 내 로컬 프로젝트랑 연결
$ git remote add origin https://github.com/<내 GitHub ID>/toss-external-mobile-web.git

// 추가할 파일 더하기
$ git add .
//커밋 메시지 작성
$ git commit -m 'init'
//master브랜치로 업로드
$ git push origin master

 

 

새로운 브랜치 생성

//브랜치 생성
$ git branch <branch 이름>

//브랜치로 이동
$ git checkout <branch 이름>

// 위 두개의 명령어를 같이 실행 ( 브랜치 생성후 이동)
$ git checkout -b <branch 이름>  

// 브랜치 확인 ( 선택사항 ) - q눌러서 빠져나오기
$ git branch

 

 

해당 브랜치로 작업진행후 업로드

// 추가할 파일 더하기
$ git add .
//커밋 메시지 작성
$ git commit -m '메시지 작성'
//master브랜치로 업로드
$ git push origin <branch 이름>  

// 상태확인 ( 선택사항 )
$ git status

 

 

Pull Request 생성 및 작성

  • push 작업후 홈페이지의 repository로 들어가면 해당 버튼이 활성화 되어있음!
 
  • 만약 해당 버튼이 활성화 되어있지 않을경우

  • pull request - new pull request 버튼 클릭
  • 새로운 request 작성해주면됨!​

pull request 내용 작성후 creat pull request 버튼 클릭

pull request 에서 리스트로 확인이 가능함

merge pull request 버튼을 클릭

완료 및 코드 리뷰 작성