밥먹듯이 쓰는 Git commands 모음

알모·2021년 12월 10일

- 리모트 브랜치 동기화

git remote update origin --prune

- 로컬 브랜치 삭제

git branch -d {브랜치명}

- 리모트 브랜치 삭제 (둘 중 하나 아무거나 쓰면 됨)

git push origin —-delete {브랜치명}
git push origin :{브랜치명}

- 리모트 브랜치 일괄 삭제

git branch -r | grep -Eo '{pattern}.*' | xargs -I {} git push origin :{}

- 브랜치 생성 & 체크아웃

git checkout -b {브랜치명}

- 브랜치 이름 변경

git branch -m {변경전} {변경후}

- 태그 생성

git tag {태그명}

- 태그 푸쉬

git push origin {태그명}

- 태그 삭제

git tag -d {태그명}

- 원격저장소 등록
(fork 떠왔을 때 원본을 upstream이라는 단축이름으로 연결하자)

git remote add {단축이름} {저장소 주소}

- 임시저장

git stash 
git stash save

- 임시저장 리스트 보기

git stash list

- 임시저장 꺼내오기
(apply : 가장 최근 것)

git stash apply 
git stash apply stash@{인덱스}

- 임시저장 삭제
(pop : apply + drop)

git stash drop stash@{인덱스}
git stash pop

- 마지막 커밋 수정
(no-edit 옵션 : 커밋 메시지는 수정하지 않음)

git commit --amend
git commit —amend —no-edit 
profile
우당탕탕 개발 공부

0개의 댓글