[GIT] commit, add 취소하기

Coastby·2022년 10월 23일
0

기타

목록 보기
3/11

⭕️ Git commit 취소하기

// [방법 1] commit을 취소하고 해당 파일들은 staged 상태로 워킹 디렉터리에 보존
$ git reset --soft HEAD^
// [방법 2] commit을 취소하고 해당 파일들은 unstaged 상태로 워킹 디렉터리에 보존
$ git reset --mixed HEAD^ // 기본 옵션
$ git reset HEAD^ // 위와 동일
$ git reset HEAD~2 // 마지막 2개의 commit을 취소
// [방법 3] commit을 취소하고 해당 파일들은 unstaged 상태로 워킹 디렉터리에서 삭제
$ git reset --hard HEAD^
https://gmlwjd9405.github.io/2018/05/25/git-add-cancle.html

⭕️ Git add 취소하기

commit을 한번도 하지 않았을 때

git rm --cashed [파일이름]

첫 commit후

git reset HEAD		# 모두 취소
git reset HEAD [파일이름]
profile
훈이야 화이팅

0개의 댓글