[开源工具]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
相关推荐
KaneLogger8 小时前
OpenCode 操作手册
git
木子小喵8 小时前
通俗讲解Git安装每一步!!
git
IOT那些事儿10 小时前
TortoiseGit拉取开源子仓库失败
git·ssh·tortoisegit·submodule
不想看见40411 小时前
Git的多种仓库选择与推荐
git
脆皮炸鸡75516 小时前
Linux开发工具~~~版本控制器Git以及调试工具GDB
linux·服务器·开发语言·经验分享·git·学习方法
console.log('npc')18 小时前
团队协作提交自己的功能
git
独隅19 小时前
开源项目 Git 贡献全流程的完整拆解:从 Fork 到 PR
git·开源
___波子 Pro Max.20 小时前
Git Rebase: HEAD~ 的简洁写法
git
bxri20 小时前
团队协作中的 Git 工作流(企业级实战)
git·gitee·github
ljh57464911920 小时前
git log source-branch --oneline 命令
git