1. 先使用 git reflog 查看剛才你還沒 push 的 commit 在哪

$ git reflog
b846b19 HEAD@{0}: reset: moving to origin/hotfix_#467_fix_email_reveal
ebe56b3 HEAD@{1}: checkout: moving from c50a74fa95aa586738946320a2d6bd013a4fb0e6 to ebe56b3c1cb256e2c07c34db9d5c6a3aff60240c
c50a74f HEAD@{2}: checkout: moving from hotfix_#467_fix_email_reveal to c50a74fa95aa586738946320a2d6bd013a4fb0e6
b846b19 HEAD@{3}: checkout: moving from 9f137318cee420484b7e1c3b70c16ab1debab782 to hotfix_#467_fix_email_reveal
9f13731 HEAD@{4}: checkout: moving from hotfix_#467_fix_email_reveal to 9f13731
b846b19 HEAD@{5}: checkout: moving from 9f137318cee420484b7e1c3b70c16ab1debab782 to hotfix_#467_fix_email_reveal
9f13731 HEAD@{6}: commit: 8787878787
4acb037 HEAD@{7}: checkout: moving from hotfix_#467_fix_email_reveal to 4acb037117557efe4b451fd3af4a7a3fad6a61d4

2. 再下 git checkout 到你消失的 commit (例 87878787)

$ git checkout 9f13731
Previous HEAD position was b846b19... [Feature] - #467 - hide commit message
HEAD is now at 9f13731... 8787878787

 

創作者介紹
創作者 wbkuo 的頭像
wbkuo

長島冰茶的工程師筆記

wbkuo 發表在 痞客邦 留言(0) 人氣()