[开源工具]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
相关推荐
会豪4 小时前
Git命令-图解-小白专享
git
韦禾水4 小时前
IntelliJ IDEA 2023更新git凭据
git·intellij idea
Yvonne爱编码5 小时前
构建高效协作的桥梁:前后端衔接实践与接口文档规范详解
前端·git·ajax·webpack·node.js
@CLoudbays_Martin115 小时前
CDN是否能有效检测并且同时防御Ddos 和 CC 攻击?
java·服务器·网络·数据库·git·数据库开发·时序数据库
oscar99921 小时前
Monorepo 全面解析:优势、挑战与适用场景
git·monorepo
龙之叶1 天前
Git Commit 生成与合入 Patch 指南
git
裸奔的大金毛1 天前
Tekton - 自定义镜像配置git仓库克隆
git·ci/cd·devops·tekton
Adorable老犀牛1 天前
可遇不可求的自动化运维工具 | 2 | 实施阶段一:基础准备
运维·git·vscode·python·node.js·自动化
xiaok1 天前
把代码上传到gitee的时候,怎么忽略node_modules文件夹
git·gitlab·github
唐叔在学习1 天前
听说有老哥分不清Git branch和tag?这不看看嘛
git·后端