[开源工具]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
相关推荐
jstart千语2 小时前
【Git】连接github时的疑难杂症(DNS解析失败)
git·github
工具罗某人3 小时前
TortoiseGit使用图解
git
Zhuai-行淮3 小时前
vscode和git 踩坑
ide·git·vscode
这颗橘子不太甜QAQ4 小时前
Husky使用技巧
javascript·git·代码规范
fanTuanye4 小时前
Git基本使用(很详细)
git·github
忍者扔飞镖4 小时前
git
git
李菠菜6 小时前
解决Windows系统下Git克隆时报错“unable to checkout working tree”的方法详解
windows·git
island13146 小时前
【git#4】分支管理 -- 知识补充
大数据·git·elasticsearch
船长@Quant8 小时前
协作开发攻略:Git全面使用指南 — 引言
git·版本控制·源代码管理·协作开发
极小狐8 小时前
极狐GitLab 项目功能和权限解读
运维·git·安全·gitlab·极狐gitlab