[GIT] git history 지우기

Jeongkyu(Jun)·2023년 7월 18일

이것저것

목록 보기
3/5

다음은 깃 레포지토리에 history 내역을 지우는 방법이다.

!주의사항 항상 백업하는 습관!

1. 커밋 기록 조회

git log

2. reset을 통한 커밋 삭제

git reset HEAD^
//n개 커밋 삭제
git reset --hard HEAD~n
//특정 commit으로 복구
git reset --hard <commit>

3. remote history 업데이트

git push -f origin <branch name>

profile
안녕하세요

0개의 댓글