[개발지식] git branch 생성하기

Hyo Kyun Lee·2021년 10월 28일
0

개발지식

목록 보기
5/43

1. CMD를 통한 git init

git init 및 commit의 별도 설정이 없다면 master branch로 push 한다.

  • git init : 변경관리점 생성
  • git add . : 해당 경로에서의 변경점을 git에 반영
    → 현재까지의 git branch는 master이다.
  • git remote master https://~(*원격주소) : 원격저장소와 로컬저장소를 연결
  • git push : master branch로 git push(원격 저장소에 생성되어있는 branch는 origin, 여기에 master가 추가된 상태)

2. origin master로 일괄 push

개인 toy project 등, 별도 다른 branch 관리가 필요없을 경우 최초 commit부터 origin branch로 git push 한다.

  • git init : 변경관리점 생성
  • git add . : 해당 경로에서의 변경점을 git에 반영
  • git branch -M main : git branch를 현재 생성되어있는 main(origin)에서 관리
  • git branch : 현재 git branch 확인
  • git remote add origin https://~(*원격주소) : 원격저장소와 로컬저장소를 연결
  • git push(git push -u origin main) : main branch로 git push

0개의 댓글