#브랜치 생성 & 이동
git checkout main #main branch로 돌아옴
git branch -d <브랜치이름> #branch 삭제
git push origin <브랜치이름> #브랜치 원격서버에 전송
#변경 사항 발행
git push origin main #변경사항 원격서버에 업로드
git push #새로운 저장소 생성
git init
#저장소 복제
git clone <URL>
#추가 및 확정
git add <파일명>
git add *
git reset HEAD <file> #add 취소
git commit -m "커밋메시지"
git reset HEAD^ #commit 취소
git commit --amend #commit message 변경
git status
#branch 작업
git branch #브랜치 목록
git checkout -b <브랜치이름> #브랜치 생성 & 이동
git checkout main #main branch로 돌아옴
git branch -d <브랜치이름> #branch 삭제
git push origin <브랜치이름> #브랜치 원격서버에 전송
#변경 사항 발행
git push origin main #변경사항 원격서버에 업로드
git push <remote> <브랜치이름>
git remove add origin <원격주소> #원격 주소와 연결
#갱신 및 병합
git pull #원격 저장소의 변경 내용이 현재 디렉트로이에 가져와지고 병합됨
git merge <브랜치이름> #현재 브랜치에 다른 브랜치의 수정사항 병합
git diff <브랜치이름> <다른 브랜치 이름> #변경 내용 merge전에 바뀐 내용을 비교할 수 있음
#로컬 변경사항 return 작업
git checkout -- <파일명> #로컬의 변경 사항을 변경 전으로 되돌림
git fetch origin #원격에 저장된 git프로젝트의 현 상태를 다운로드
#특정 branch만 클론
git clone -b {branch_name} --single-branch {저장소 URL}
ex) git clone -b javajigi --single-branch <https://github.com/javajigi/java-racingcar>