Winse Blog

走走停停都是风景, 熙熙攘攘都向最好, 忙忙碌碌都为明朝, 何畏之.

记git Reset --hard

平时不是所有的改动都提交,也保留一些临时代码。今天在主干上提交了后,需要reset后退到前几天的版本,但是直接checkout是新建一个分支,如果reset sort还需要处理index,麻烦,就在eclipse中点击了reset hard,我勒个去,直接把 原来提交过的代码 改动没提交的 给还原了!!!

https://stackoverflow.com/questions/9529078/how-do-i-use-git-reset-hard-head-to-revert-to-a-previous-commit

First, it’s always worth noting that git reset –hard is a potentially dangerous command, since it throws away all your uncommitted changes. For safety, you should always check that the output of git status is clean (that is, empty) before using it.

–END

Comments