Local Repository 는 Git 이 관리하는 3가지 단계로 구성되어 있음
• Working Directory (작업공간) - 실제 소스 파일, 생성한 파일들이 존재
• Index (Stage) - Staging area (준비영역) 의 역할, git add 한 파일들이 존재
• HEAD - 최종 확정본, git commit 한 파일들이 존재

% mkdir git_wsWorkspace로 이동한 뒤 Working Directory 생성
% cd git_ws
git_ws % mkdir test_project폴더에서 Git을 초기화하는 명령어를 사용하면 해당 폴더를 Git이 관리하기 시작
git init.git 폴더가 생성된 것을 확인 → .git 으로 이동해서 파일을 살펴보면 Git 관련 파일들이 생성된 것을 확인
Working Directory 에 파일을 생성
참고> touch 명령어 : 빈 파일을 생성
test_project % touch test.txt 
test_project % ls 
test.txtGit 에 존재하는 파일 확인
git statusWorking Directory 에서 변경된 파일을 Index (stage)에 추가
git add <filename>Index (stage) 에 추가된 변경사항을 HEAD 에 반영 (확정)
git commit -m "commit 에 대한 설명" <filename>



보안상의 이유로 Remote Repository 접속 시 비밀번호 대신 Token을 사용






Local Repository 에 연동할 Remote Repository 를 등록 (Token 사용)
왼쪽 상단 고양이를 눌러서 GitHub Home 으로 이동 > 생성해둔 Remote Repository 선택


git remote add origin https://github.com/<repository>.git
git remote add origin https://<username>:<token>@github.com/<repository>.gitgit remote -vgit push origin <branchname>Remote Repository 페이지에서 새로고침 하면 Push 된 파일이 보임





git pull origin <branchname>Local Repository를 생성하지 않은 상태에서 Git Clone 명령을 사용하여 Remote Repository를 Local에 복제할 수 있음
앞서 폴더를 만들고, Git Init 으로 해당 폴더를 초기화 하고, Remote Repository 를 등록하고, Remote Repository의 내용을 Pull 하는 모든 과정을 Git Clone 으로 할 수 있음
git clone https://github.com/<repository>.gitgit clone https://<username>:<token>@github.com/<repository>.gitgit branchgit branch -rgit branch -agit branch <branchname>git checkout <branchname>git checkout -b <branchname>git branch -d <branchname>git push origin --delete <branchname>