[开源工具]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
our_times12 小时前
# Git 高频命令实战指南:从日常开发到进阶协作
git
PBitW13 小时前
git 中容易遗忘的点 (二) ⚡⚡⚡
前端·git·面试
PBitW13 小时前
git 中容易遗忘的点 (三) 🚀🚀🚀
前端·git·面试
郑州光合科技余经理16 小时前
家政预约小程序后端源码深度剖析:支付回调实战
java·开发语言·前端·git·小程序·架构·php
北极糊的狐17 小时前
钉钉小程序 Git 版本管理完整流程
git·小程序·钉钉
Fzuim1 天前
当 AI 也成为提交者:ThinkFlow 的 Git 提交规范,是怎么定的
git·agent·thinkflow
CodexDave2 天前
数据库连接池耗尽:排查顺序与三层兜底
服务器·前端·数据库·git·云原生·容器·kubernetes
乐观的Terry2 天前
5、发布系统-Git 集成
大数据·git·elasticsearch
不怕犯错,就怕不做2 天前
GIT的简单打patch应用format-patch and git am
linux·git·全文检索