[开源工具]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
相关推荐
@蓝眼睛1 小时前
mac的m3芯片通过Homebrew安装git
git·macos
郭二哈3 小时前
git的使用
大数据·网络·git·elasticsearch
叔叔别拉了我害怕4 小时前
封装FTPSClient连接ftps服务器
服务器·git·github
火车叼位6 小时前
Git 历史清理实践:彻底移除误提交的 node_modules
git
火车叼位6 小时前
用git filter-repo轻松清理Git仓库历史的详细教程
git
Lily55_Li8 小时前
Git标准化开发流程
git
江城月下8 小时前
Git 版本控制核心流程与协作指南(从入门到冲突解决)
git
Revol_C10 小时前
【Git 操作笔记】第1期--云代码仓库更换服务商,本地如何批量更新对应项目的git地址(持续更新...)
前端·git
猫头虎11 小时前
开源协议区别与限制详解:Fork、改名、再发布是否合法?(MIT、Apache、GPL、BSD、SSPL、BSL)
git·开源·github·apache·开源软件·开源协议·gitcode
Kiri霧21 小时前
Git入门
git