git撤销commit到未提交状态
如何把最后一次commit撤销回Changesnotstaged和Untrackedfiles区呢?
有3种情况:
(1)把最后的commit切回Changestobecommitted状态,使用命令:
gitreset--softHEAD^
注意:Windows系统需要在^符号后面两边加上引号,如:
gitreset--softHEAD"^"
(2)把最后的commit切回Changesnotstagedforcommit状态,使用命令:
gitresetHEAD^
(3)把Changestobecommitted状态切回Changesnotstagedforcommit状态,使用命令:
gitresetHEAD<file>...#单个文件 gitresetHEAD--.#所有Changestobecommitted的文件
最后一条命令在git命令行也有提示,不需要记住。
参考资料:
- Move(or“Undo”)lastgitcommittounstagedarea[duplicate]
热门推荐
10 儿子立冬祝福语简短独特
11 对当兵的祝福语简短
12 侄儿高考试祝福语简短
13 伴郎红包祝福语朋友简短
14 媳妇生日简短祝福语朋友
15 公司年会祝福语简短最好
16 元旦感恩祝福语简短大全
17 红包祝福语简短10字
18 周六早晨祝福语简短