물론 HEAD를 바꿔야합니다. 물론 git HEAD ....
대답하기 전에이 내용을 설명하는 배경을 추가해 보겠습니다 HEAD.
First of all what is HEAD?
HEAD단순히 현재 분기의 현재 커밋 (최신)에 대한 참조입니다. 주어진 시간에
하나만있을 수 있습니다 HEAD. (제외 git worktree)
내용은 HEAD내부에 저장 .git/HEAD되며 현재 커밋의 40 바이트 SHA-1을 포함합니다.
detached HEAD
최근 커밋-의미에 있지 않은 경우 HEAD기록에서 이전 커밋을 가리키고 detached HEAD있습니다.

명령 행에서 분기 이름 대신 다음과 같이 표시됩니다 HEAD. 현재 분기의 끝을 가리 키지 않기 때문 입니다.


분리 된 HEAD에서 복구하는 방법에 대한 몇 가지 옵션 :
git checkout <commit_id>
git checkout -b <new branch> <commit_id>
git checkout HEAD~X // x is the number of commits t go back
원하는 커밋을 가리키는 새 분기를 체크 아웃합니다.
이 명령은 주어진 커밋을 체크 아웃합니다.
이 시점에서 지점을 만들고이 시점부터 작업을 시작할 수 있습니다.
# Checkout a given commit.
# Doing so will result in a `detached HEAD` which mean that the `HEAD`
# is not pointing to the latest so you will need to checkout branch
# in order to be able to update the code.
git checkout <commit-id>
# create a new branch forked to the given commit
git checkout -b <branch name>
당신은 항상 사용할 수 있습니다 reflog.
git reflog변경 사항을 표시 HEAD하고 원하는 참조 로그 항목을 체크 아웃하면 HEAD이 커밋으로 다시 설정됩니다 .
HEAD가 수정 될 때마다 reflog
git reflog
git checkout HEAD@{...}
원하는 커밋으로 돌아갑니다.

HEAD를 원하는 커밋으로 "이동"하십시오.
# This will destroy any local modifications.
# Don't do it if you have uncommitted work you want to keep.
git reset --hard 0d1d7fc32
# Alternatively, if there's work to keep:
git stash
git reset --hard 0d1d7fc32
git stash pop
# This saves the modifications, then reapplies that patch after resetting.
# You could get merge conflicts if you've modified things which were
# changed since the commit you reset to.
- 참고 : ( Git 2.7 이후 )
도 사용할 수 있습니다 git rebase --no-autostash.
지정된 커밋 또는 커밋 범위를 "실행 취소"합니다.
reset 명령은 지정된 커밋에서 변경 한 내용을 "실행 취소"합니다.
실행 취소 패치가 포함 된 새 커밋이 커밋되고 원래 커밋도 기록에 남아 있습니다.
# add new commit with the undo of the original one.
# the <sha-1> can be any commit(s) or commit range
git revert <sha-1>
이 스키마는 어떤 명령이 무엇을 수행하는지 보여줍니다.
보시다시피을 reset && checkout수정하십시오 HEAD.
