git 되돌리기

페이지 정보

작성자 조희승 댓글 0건 조회 5,979회 작성일 18-07-06 14:50

본문

git reset HEAD^

이 명령을 사용하면 커밋 하나를 되돌릴 수 있다. 두개를 되돌리려면

git reset HEAD~2

이렇게 되돌린 다음엔 다시 커밋을 하고..

git commit -m ‘머라머라’

이제 Push를 해야되는데.. Github같은 곳에 있는 저장소로 올리려고 push하면 다음과 같은 메시지가 떨어진다.

$ git push origin master
To git@github.com:keesun/telepathy.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to ‘git@github.com:keesun/telepathy.git’
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. ‘git pull’) before pushing again. See the
‘Note about fast-forwards’ section of ‘git push –help’ for details.

원격 저장소에 있는 정보가 손실 될 수 있는 작업이라서 리젝트 시킨다. 오호.. 상당히 똑똑하다. 그런데 어쩌겠는가.. 내가 원하는 작업이 바로.. 그 작업이라네.. 없애주길 바래.

이럴때 사용할 수 있는게 +다.

git push origin +master

이렇게 +를 붙여주면 경고는 무시하고 데이터가 손실되도 push한다.




http://whiteship.me/?p=13516

댓글목록

등록된 댓글이 없습니다.