码迷,mamicode.com
首页 > 其他好文 > 详细

Git CMD - reset: Reset current HEAD to the specified state

时间:2015-12-31 12:07:44      阅读:239      评论:0      收藏:0      [点我收藏+]

标签:

命令格式

git reset [-q] [<tree-ish>] [--] <paths>…?

git reset (--patch | -p) [<tree-ish>] [--] [<paths>…?]

git reset [--soft | --mixed [-N] | --hard | --merge | --keep] [-q] [<commit>]

 

命令格式

-- soft
  回退版本,但不会回退工作区与暂存区的修改。

-- mixed
  回退版本,且只回退暂存区的修改,而不回退工作区的修改。

--hard
  回退版本,且会回退工作区与暂存区的修改。

-q, --quiet
  安静模式,仅报告错误。

 

实例

a) 撤销暂存区的所有修改至最近一次 commit

$ git reset

b) 撤销 datetime.txt 在暂存区的修改至最近一次 commit

$ git reset -- datetime.txt 

b) 重置工作区与暂存区,回退至上一个版本

$ git reset --hard HEAD^

c) 重置工作区与暂存区,回退至 ID 为 b78c7e5 的 commit

$ git reset --hard b78c7e5

 

 

更多

http://git-scm.com/docs/git-reset

Git CMD - reset: Reset current HEAD to the specified state

标签:

原文地址:http://www.cnblogs.com/huey/p/5090783.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!