这篇文章用来记录工作中会需要但又不像push,pull这么常用好记的命令:
查看git用户名和邮箱地址命令:
$ git config user.name
$ git config user.email
修改用户名和邮箱地址:
$ git config–global user.name “username”
$ git config–global user.email “email”
撤销commit(实用)
git reset --soft/mixed/hard(代表三种模式,取其一就行) HEAD~1
如果进行了两次commit都想撤回,可以使用HEAD~2
soft:不删除工作空间代码,撤销commit,不撤销git add
mixed:不删除工作空间代码,撤销commit,撤销git add
hard:删除工作空间代码,撤销commit,撤销git add
如果commit注释写错了,只想改一下注释:
git commit --amend