[开源工具]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
相关推荐
刺客xs5 小时前
git 入门常用命令
大数据·git·elasticsearch
LostSpeed7 小时前
git - github工程中不能包含大文件
git·github
pzx_0017 小时前
【GIT】删除远程文件
git
小白_ysf7 小时前
Git 命令操作完整指南(实际工作中常用命令)
git·代码上传
HealthScience8 小时前
怎么使用git下载huggingface的文件
git
huangjiazhi_8 小时前
git clone next InitializeSecurityContext failed错误
git
_oP_i9 小时前
git gui设置github sshkey
git·github
ergevv10 小时前
Git 子模块(Submodule)操作指南
git·子模块·submodule
阿拉伯柠檬11 小时前
Git原理与使用(一)
大数据·linux·git·elasticsearch·面试
chao_78912 小时前
双设备全栈开发最佳实践[mac系统]
git·python·macos·docker·vue·全栈