本人总是干这种挫事情:一顿操作猛如虎,各种git add
,各种git commit
,最后一看,我擦,还特么在master上,太吓人了,这咋办?——撤销commit:
$ git commit -m "commit on master"
$ git reset HEAD~
这样撤销了上面的commit。
后续该回滚回滚,该新建分支新建分支。
最后切记,时刻查看当前branch是个好习惯。
本人总是干这种挫事情:一顿操作猛如虎,各种git add
,各种git commit
,最后一看,我擦,还特么在master上,太吓人了,这咋办?——撤销commit:
$ git commit -m "commit on master"
$ git reset HEAD~
这样撤销了上面的commit。
后续该回滚回滚,该新建分支新建分支。
最后切记,时刻查看当前branch是个好习惯。