[ Git ] 명령어 정리

slowcurve·2023년 1월 7일
0

Git

목록 보기
2/3

📌 자주 쓰는 명령어

# 로컬 저장소 생성
$ git init

# 파일 상태 확인
$ git status

# 전체 파일 스테이징 영역 이동
$ git add .

# 스테이징 영역 파일 커밋 (서명과 함께 commit)
$ git commit -sm "Commit message"

# 원격 저장소 연결
$ git remote add "원격저장소 이름" "원격저장소 url"

# 원격 저장소로 푸쉬
$ git push "remote repository name" "branch name"

# 원격 저장소에서 풀 
$ git pull "remote repository name" "branch name"

📌 기초

# 로컬저장소에 브랜치 생성 -> 생성된 브랜치로 이동
$ git checkout -b "branch name"

# 로컬저장소 브랜치 삭제
$ git branch -D "branch name"

# 로컬저장소 브랜치 이름 변경
$ git branch -m "old name" "new name"

# 로컬저장소 브랜치가 추적하는 원격저장소 브랜치 변경
$ git branch -u "remote"/"remote branch name" "local branch name"

# 원격 저장소 상태 업데이트
$ git remote update

# 원격 저장소 최신 이력 확인
$ git fetch "remote repository name"

📌 응용

✒️ 원격저장소 브랜치 가져오기

# 원격 저장소 브랜치 업데이트
$ git remote update

# 원격 저장소 브랜치 리스트 확인
$ git branch -r

# 원격 저장소 브랜치 가져오기
$ git branch -t "remote branch name"

📌 활용

0개의 댓글