本人最近使用idea內(nèi)置git回退版本時(shí)不小心選了keep模式,發(fā)現(xiàn)版本記錄下沒有了最新提交的版本信息。那么再想回到最新提交的版本應(yīng)該怎么辦呢,下面是解決步驟:
git fsck --lost-found 命令,找出當(dāng)前被丟棄的提交
E:\BSgitlab\ds-address>git fsck --lost-found
Checking object directories: 100% (256/256), done.
Checking objects: 100% (4/4), done.
dangling commit 410087eebc7dda0aa79d0f55fcb1fef1e3f4f289
dangling blob 576078d77af4b5a7ecce4ba4e133d7b6703f2a3c
dangling blob 7060694edd0ab3da4ce6bb57fcdbc6f2e9608df6
dangling blob 9740013d879552bdd4effe4fe9ff11e9180e83a7
dangling blob 26a10fb5bb89abf135760df780de74aff6d98b69
dangling blob 5ea15e0f420abd1267a0b4ec8793bbf295c62ff5
dangling blob 6be132bad6c7940b10015c59e4e4e81b222860f9
dangling blob ac018dddd9ae61b646f7e7e3028f33b95c7f06c0
dangling blob 0a82a2fe0b09d7a68b7d74a897e8b9d0cbb29949
dangling commit 8f62c5c1dbdf5f2ba4377c89de590a552f80d6d9
git show <commit id> 顯示提交的具體信息
E:\BSgitlab\ds-address>git show 0dbd6c22c112deefebd5b62767b9bd4bb7663415
commit 0dbd6c22c112deefebd5b62767b9bd4bb7663415
Author: test <test@test.com.cn>
Date: Thu Jun 28 18:00:20 2018 +0800
<E4><B8><B4><E6><97><B6>
diff --git a/ds-match-server/application.properties b/ds-match-server/application.properties
index ff8ace2..2bb5b43 100644
--- a/ds-match-server/application.properties
+++ b/ds-match-server/application.properties
@@ -15,9 +15,9 @@ server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %F %I
git reset --hard <commit id> 回滾到指定的提交
E:\BSgitlab\ds-address>git reset --hard 0dbd6c22c112deefebd5b62767b9bd4bb7663415
HEAD is now at 0dbd6c2 臨時(shí)