[Github] Github 최근 push 취소

gogori6565·2022년 6월 22일
0

Git-Github

목록 보기
2/7

Github 최근 push 취소하기

1. 가장 최근의 commit을 취소하고 워킹 디렉터리를 되돌림

git reset HEAD^

2. 원하는 시점으로 디렉터리를 되돌림

git reset HEAD@{number}
(또는)
git reset [commit id]
  • git reflog / git log -g 를 통해 HEAD@{number} 알 수 있음

3. 되돌려진 상태에서 다시 commit

git commit -m "[커밋내용]"

4. 원격 저장소에 강제로 push

git push [원격저장소이름] [브랜치명] -f  //기본 원격저장소 이름 origin (변경 O)
(또는)
git push [원격저장소이름] +[브랜치명]   //+ 옵션 : 해당 branch를 강제로 push
profile
p(´∇`)q

0개의 댓글