git撤销已经提交到远程服务器的commit

git 撤销已经提交到远程服务器的commit:

一、使用git log查看需要撤回的commitId git log 二、撤销: 方式一:
//撤销commit,但不修改代码 git reset commitId 方式二: //撤销commit,同时将代码恢复到对应ID的版本 git reset --hard commitId

三、需要将撤销提交到远程服务器的执行:
  git push origin HEAD --force

//撤销一次已经commit但未push的提交

git reset --soft head^ 

猜你喜欢

转载自www.cnblogs.com/pbblogs/p/11922638.html