kimjingyu 2023. 5. 5. 19:55
728x90

📌 git branch 사용하기

  • git branch란 독립적으로 어떤 작업을 진행하기 위한 개념이다.
  • 필요에 의해 만들어지는 각각의 브랜치는 다른 브랜치의 영향을 받지 않기 때문에, 여러 작업을 동시에 진행할 수 있다.
  • 이렇게 만들어진 브랜치는 다른 브랜치와 병합(Merge)함으로써, 작업한 내용을 다시 새로운 하나의 브랜치로 모을 수 있다.

📌 branch 변경 및 사용하기

% git checkout -b myfolder

% git branch
  main
* myfolder

% git status
On branch myfolder
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   pages/01-01-qqq/index.js

no changes added to commit (use "git add" and/or "git commit -a")

% git add .
% git status
On branch myfolder
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        modified:   pages/01-01-qqq/index.js
        
% git commit -m "테스트용 주석 추가"

% git log

% git checkout main

✏️ 흐름도

vscode  --git add.--> stage --git commit--> 확정 --git push--> 원격 저장소에 

728x90