git add, git commit 취소하기

.esc·2022년 6월 2일
0

현재 상태 확인

git status, git log 로 파일들의 상태를 확인한다

git status
git log

git add 취소하기

나누어서 git add 하려고 했던것을 git add . 해버렸을때 등

add한 파일 전체 취소

git reset

add한 파일 중 특정 파일만 취소

git reset HEAD [file]

git add 후 git commit 한 것 취소하기

git add 후 git commit 까지 한 것을 취소

commit 만 취소

add한 상태로 되돌리기

git reset --soft HEAD^

add, commit 취소

add 전 상태로 되돌리기

// --mixed가 기본 옵션으로 생략 가능
git reset --mixed HEAD^
git reset HEAD^ 

참조

https://gmlwjd9405.github.io/2018/05/25/git-add-cancle.html
https://codevang.tistory.com/227

profile
front-end

0개의 댓글