[开源工具]git stash clear后如何按时间顺序找回 比git fsck --lost-found好用1W倍

[开源工具]git stash clear后如何按时间顺序找回 比git fsck --lost-found好用1W倍

    • 1.第一步不要慌
    • 2.网上通用的方法
      • [2.1查看丢失记录 git fsck --lost-found](#2.1查看丢失记录 git fsck --lost-found)
      • [2.2查看具体内容 git show commitId](#2.2查看具体内容 git show commitId)
    • 3.推荐方法
      • [3.1 Git Bash Here](#3.1 Git Bash Here)
      • [3.2 执行 git log](#3.2 执行 git log)
      • [3.2 恢复代码](#3.2 恢复代码)

1.第一步不要慌

2.网上通用的方法


2.1查看丢失记录 git fsck --lost-found

git fsck --lost-found找回丢失的satsh记录,只有commit 才能够被恢复

2.2查看具体内容 git show commitId

git show commitId

3.推荐方法

参考了网友博客

3.1 Git Bash Here

3.2 执行 git log

git log --graph --oneline --decorate  $( git fsck --no-reflog | awk '/dangling commit/ {print $3}' ) >xxx.txt

已经按顺序排好了

3.2 恢复代码

git stash apply a30ce5e8
相关推荐
课堂随想2 分钟前
SHA-1 是一种不可逆的、固定长度的哈希函数,在 Git 等场景用于生成唯一的标识符来管理对象和数据完整性
git·哈希算法
易雪寒2 小时前
IDEA在git提交时添加忽略文件
java·git·intellij-idea
徒步僧4 小时前
mac中文件夹怎么显示.git隐藏文件
git·macos
int WINGsssss1 天前
Git使用
git
用户0760530354381 天前
Git Revert:安全移除错误提交的方式
git
Good_Starry2 天前
Git介绍--github/gitee/gitlab使用
git·gitee·gitlab·github
云端奇趣2 天前
探索 3 个有趣的 GitHub 学习资源库
经验分享·git·学习·github
F_D_Z2 天前
【解决办法】git clone报错unable to access ‘xxx‘: SSL certificate problem:
网络·git·网络协议·ssl
等风来不如迎风去2 天前
【git】main|REBASE 2/6
git
艾伦~耶格尔2 天前
IDEA 配置 Git 详解
java·ide·git·后端·intellij-idea