[Git] Push 취소하기

Page·2022년 5월 29일
0

Git

목록 보기
3/4

문제

Master branch에서 a, b, c 세 가지 브랜치로 나누어 각자 개발을 진행하고 있었다.

내 파트를 다 마치고 Master에 pull request를 해야하는데 실수로 merge를 해버렸고, 이미 다른 브랜치와 Master가 한번 합쳐진 상황이었다.

해결

git checkout master // local의 master 브랜치로 이동
git pull origin master  
git log // push 이력 확인 
git reset --hard "commit hashing" 
git push -f origin master 

이렇게 하면 잘못 푸시된 커밋이 모두 삭제되고 reset까지의 이력만 남게된다.

0개의 댓글