Git 핵심 명령어 정리

gitcloneinitbranchremoteaddcommitpushfetchresetrm
avatar
2025.04.10
·
2 min read

깃 원격 저장소 가져오기

$ git clone https://github.com/UGKONG/workLog.git


깃 초기화

$ git init


깃 로컬 브랜치 생성

$ git branch -M main


깃 원격 연결

$ git remote add origin https://github.com/UGKONG/workLog.git


깃 파일 로컬 저장소 추가

$ git add . (전체파일)

$ git add -A (변경된 파일)


깃 커밋

$ git commit -m '메시지'


깃 업로드

$ git push -u origin main (처음업로드)

$ git push -f origin main (업로드)


깃 로컬 저장소 업데이트 (원격저장소 것으로 최신화)

$ git fetch

$ git reset –-hard origin/main


깃 원격파일 삭제

$ git rm –-cached -r 파일명

$ git rm –-cached -r . (전체파일 삭제)


커밋

$ git commit -m 'RESET'


업로드

$ git push







- 컬렉션 아티클