Undoing a 'git push'

前端 未结 12 1001
遥遥无期
遥遥无期 2020-11-22 13:45

Here\'s what I did on my supposed-to-be-stable branch...

% git rebase master
First, rewinding head to repla         


        
12条回答
  •  失恋的感觉
    2020-11-22 14:01

    The accepted solution (from @charles bailey) is highly dangerous if you are working in a shared repo.

    As a best practice, all commits pushed to a remote repo that is shared should be considered 'immutable'. Use 'git revert' instead: http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#fixing-mistakes

    https://git-scm.com/book/be/v2/Git-Basics-Undoing-Things

提交回复
热议问题