git init

 현재 디렉토리를 git 저장소로 설정

 git status

 현재 add/commit 또는 새로 생성된 파일들의 목록 보기

 

 

 git config --global user.name [user name]

 사용자 이름 설정

 git config --global user.email [user email]

 사용자 이메일 설정

 git config --global --list

 설정값 확인

 

 

 git remote add [remote name] [remote url]

 별명(remote name)으로 원격지 주소 저장

 git remote rm [remote name]

 별명으로 원격지 주소 삭제

 git remote rename [remote name] [new name]

 별명 변경

 

 

 git fetch [remote name]

 원격저장소의 내용 가져오기(branch)

 git merge [branch name]

 브런치의 내용을 가져와 로컬에 병합하기

 git pull [remote name] [localbranch name]

 원격저장소의 내용 가져와 병합하기

 

 

 git add *

 stage에 모든 파일/폴더 추가(.으로 시작 제외)

 git add .

 stage에 모든 파일/폴더 추가(.으로 시작 포함)

 git add [file or folder]

 stage에 특정 파일/폴더 추가

 git reset HEAD [file name]

 stage에 올라간 특정 파일 내리기

 git commit -m [message]

 message와 함께 Head에 올리기

 git push [remote name] [localbranch name]

 로컬브런치 내용을 원격저장소로 업로드

 

 

 git push [server] tag [TAG]

 서버에 tag 전송

 git push [server] --tags

 변경된 모든 tag 전송

 git push [server] [L.B]:[R.B]

 서버에 로컬브런치를 리모트브런치 이름으로 저장

 git tag [TAG name]

 원격저장소에 태그 붙이기

 git tag

 태그 목록 보기

 

 

 git branch

 내가 현재 위치한 브런치 목록 보기

 git branch [branch name]

 원격저장소에 브런치이름으로 브런치 생성

 git branch -a

 모든 로컬브런치와 리모트브런치 확인

 

 

 git checkout [branch name]

 다른 브런치로 전환

 git checkout -b [branch name]

 브런치 생성 후 전환

 git checkout -- [file or folder]

 지정한 파일/폴더를 수정하기 이전 상태로 복원

 git checkout [id]

 원격저장소 기준 id에 해당하는 커밋으로 복원

 git checkout -f

 변경된 파일들을 Head의 상태로 복원

 

 

 git clean -f

 workspace에 있는 untracked file 모두 삭제

 

 

 git rm [file or folder]

 해당 파일을 workspace에서 삭제하고 stage에 등록

 git diff

 로컬저장소와 원격저장소의 차이 보기

 git remote

 원격저장소 확인

 git log

 현재까지 commit된 목록 확인


블로그 이미지

망원동똑똑이

프로그래밍 지식을 자유롭게 모아두는 곳입니다.

,