且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

撤消已推送到远程存储库的 Git 中的特定提交

更新时间:2021-11-28 05:24:27

确定提交的hash,使用git log,然后使用git revert 创建一个删除这些更改的新提交.在某种程度上,git revertgit cherry-pick 的反面——后者将补丁应用到一个缺少它的分支,前者从一个分支中删除它有.

Identify the hash of the commit, using git log, then use git revert <commit> to create a new commit that removes these changes. In a way, git revert is the converse of git cherry-pick -- the latter applies the patch to a branch that's missing it, the former removes it from a branch that has it.