작업트리 -(add)> 스테이지 -(commit)> 저장소
git add (변경사항 저장)
. 다음 commit 기록 전 모아놓는 작업
git add . // (모든 파일)
git add temp.txt // (특정 파일)
git commit (변경사항 확정)
. staging area의 변경사항 → 로컬 저장소 등록
git commit -m "message"
git commit --ammend -m "changed message" // (메시지 수정)
git push (원격저장소 업로드)
. commit 된 파일을 원격저장소 업로드
git push
git status원격저장소
git remote remove origin // 연결된 저장소 제거
git remote add origin https~.git // 원격 저장소 재연결
git remote -v //원격 연결상태 확인
생성/삭제
touch temp // 파일 생성
rm -r temp // 재귀적 삭제
rm -rf temp // 강제 삭제 (읽기전용, 보호된 파일 등 모두 삭제)
git branch
git branch // 현재 브랜치 확인
git branch main // main 브랜치 생성
git checkout main // main으로 전환
git branch -m master main // master를 main으로 이름 변경
git push origin -d main // main 브랜치 삭제
git stash // 로컬 수정사항 임시공간 이동
git pull origin main // 원격 저장소 pull
git stash pop // 로컬 수정사항과 원격 저장소 pull한 파일 merge