Local Repository는 Git이 관리하는 3가지 단계로 구성
- Working Directory (작업공간) - 실제 소스 파일, 생성한 파일들이 존재
- Index (Stage) - Staging area (준비영역) 의 역할, git add한 파일들이 존재
- HEAD - 최종 확정본, git commit 한 파일들이 존재
[Working Direcroty]
-add->[Index(Stage)]
-commit->[HEAD]
git init
mkdir git_ws
cd git_ws
mkdir test_project
cd test_project
git init
ls -all
: 숨긴 파일 보기ls
ls -all
touch test.txt
git status
git add fileName
git add test.txt
git commit -m 'first commit' test.txt
git 사이트에서 test_project repository 생성
token 생성: settings -> developer settings -> new personal access token(classic)
Remote Repository 등록 with Username and Token
git remote add origin https://<username>:<token>@github.com/<repository>.git
git remote -v
git remote remove origin
Local Repository(HEAD) 에 반영된 변경내용을 Remote Repository에도 반영하기 위해서는 Git Push를 사용
git push origin <branchname>
test_project % git push origin master
test_project % git push origin main
Remote Repository의 내용에 맞춰 local repository를 갱신하려면 git pull 사용
git pull origin <branchname>
test_project % git pull origin master