CS/Git

[GIT] 특정 commit 삭제하기

Harimad 2022. 3. 8. 15:25

문제인식

밑줄의 commit 을 삭제 하고싶을때 어떻게 해야할까?

 

해결방안

git rebase -i HEAD~2

git rebabse

- Reapply commits on top of another base tip

 

-i, --interactive

Make a list of the commits which are about to be rebased.

Let the user edit that list before rebasing.

 

HEAD~2

- HEAD에서 2번째 떨어진 commit 까지 가져오겠다

 

실행화면

pick -> drap으로 변경한다

 

실행결과

해당 커밋이 삭제가 된다