git使用reset回退版本后找不到最新版本的解决办法
程序员文章站
2022-03-07 10:25:31
...
本人最近使用idea内置git回退版本时不小心选了keep模式,发现版本记录下没有了最新提交的版本信息。那么再想回到最新提交的版本应该怎么办呢,下面是解决步骤:
git fsck --lost-found 命令,找出当前被丢弃的提交
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 <[email protected]>
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 临时
作者:Mr_Samuel
原文链接:https://www.jianshu.com/p/7da2b3c90a37
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。