git 几种情况的回滚

  1. 增加了几个文件, 没有 add, 不想保存文件, 怎么快速清除文件?

  2. 增加了 add 了文件, 不想保存文件, 怎样清理?

  3. 修改了文件, 没有 add, 怎样清理?

  4. 修改了文件, 已经 add, 怎样清理?

 

  1. git clean -f ( -d if you have new directory )
  2. git reset --hard ( or git reset then back to 1. )
  3. git checkout . ( or specify with file names )
  4. git reset --hard ( or git reset then back to 3. )
posted @ 2017-03-16 16:59  hellowego  阅读(200)  评论(0编辑  收藏  举报