1. GitHub에서 리포지터리 생성
2. 폴더 만들고 vscode 열기
3. ctrl + J로 터미널창 열고 Git Bash 창 열기
4. .git 폴더 생성 => git init
5. master에서 main으로 변경 : git branch -M main
git config --global init.defaultBranch main
6. 사용자 설정
- 현재 폴더만 사용자 바꾸기
git config user.name ""
git config user.email ""
- 전체 폴더 사용자 바꾸기
git config --global user.name ""
git config --global user.email ""
사용자 확인 방법
- git config user.name
git config user.email
7. 리포지터리
- 리포지터리 설정
git remote add origin 리포지터리 주소
- 리포지터리 삭제
git remote remove origin
- 리포지터리 확인
git remote -v
8. 상태 확인 및 장바구니 담기
git 상태확인 : git status
git 장바구니 담기 : git add '파일 이름'
git 장바구니 모두 담기 : git add .
git 장바구니 취소 : git reset
9. commit 메시지
- 커밋 메세지
git commit -m "커밋 내용"
이왕이면 영어 한국어도 상관 없음
- 커밋 내용 확인
git log
- 커밋 수정
git commit --amend
- 수정모드 : a, i
- 저장 : esc => :wq!
10. git에 올리기
git push origin main
11. 리포지터리에서 가져오기 - clone
- 소스코드가 아예 없는 처음 상태에서 가져오는 법
git clone 리포지터리 주소
- 폴더 옮기는 방법
cd + Tab
12. 리포지터리에서 가져오기 - pull
- 이미 소스코드가 있는 상태에서 최신 소스코드만 가져오는 법
git pull origin main
항상 작업하기 전에 먼저 pull을 해야함
13. 코드 소스 수정 후 다시 올리기