zoukankan      html  css  js  c++  java
  • [Git] Recover Local Changes from `git reset --hard` with `git reflog`

    If you've removed a commit with git reset --hard, it's still possible to recover the commit using git reflog to look up the commit hash.

    Once we find the right commit hash, we can reset our branch back to that commit hash with git reset --hard [HASH]

    NOTE! git will actually garbage collect abandoned commits (every 30 days or so - so not very often) - so you can't recover from a reset --hard forever; which is why it's recommended to avoid --hard if you ever want to references those changes.

    git reflog
    

    Find the commit id which you want to recover then do:

    git reset --hard [AHSH-id]
  • 相关阅读:
    python 循环的概念
    python 字典的基本操作
    短路表达式
    快捷键myeclipse
    nginx静态文件访问
    安装mysql
    安装mongodb
    安装tomcat
    安装jdk8
    安装node和pm2
  • 原文地址:https://www.cnblogs.com/Answer1215/p/12168646.html
Copyright © 2011-2022 走看看