How do I reset a bad commit using git on a remote branch?

This question already has an answer here:

  • Delete commits from a branch in Git 23 answers

  • Two possible, different solutions:

  • git revert commit1; git push git revert commit1; git push - creates a new commit, which reverts commit 1

  • git rebase -i HEAD~3 then just delete the commit 1 and git push -f but note this requires privilege to "force push" which means rewriting history which is not always desirable (do your research, this is typically viable only when working on code that has not been distributed/published/frozen). Refer to man pages for more details.

  • 链接地址: http://www.djcxy.com/p/9002.html

    上一篇: 使用git删除提交

    下一篇: 如何重置在远程分支上使用git的错误提交?