[开源工具]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
相关推荐
GISer_Jing2 小时前
Git协作开发:feature分支、拉取最新并合并
大数据·git·elasticsearch
高山莫衣8 小时前
git rebase多次触发冲突
大数据·git·elasticsearch
码农藏经阁8 小时前
工作中常用的Git操作命令(一)
git
kobe_OKOK_8 小时前
【团队开发】git 操作流程
git·elasticsearch·团队开发
码农垦荒笔记8 小时前
Git 安装闭坑指南(仅 Windows 环境)
windows·git
CC码码18 小时前
管理你的多个 Git 密钥(多平台多账号)
git·gitlab·github
CC码码18 小时前
管理你的多个 Git 密钥(单平台多账号)
git·gitlab·github
大卫小东(Sheldon)18 小时前
GIM 1.5发布了! 支持Windows系统了
git·ai·rust
flying jiang18 小时前
将大仓库拆分为多个小仓库
git
李boyang10 天前
Git(四):远程操作
git