Undo a git push on github

前端 未结 2 857
闹比i
闹比i 2021-02-05 08:08

I made a mistake .... and I don\'t know how to fix it.

I explain the issue.

I was working on my project, and I did a first commit. In this commit 2 big useless

2条回答
  •  心在旅途
    2021-02-05 08:59

    If no one else has pulled, you should just get your local branch back to how you want it (probably by either resetting to a previous position, or by doing an interactive rebase to remove the unwanted commit), then push again to github with the -f (force) option:

    git push -f  
    

    If other people have pulled, the usual advice applies: read the recovering from upstream rebase section of the git-rebase man page to see what you're doing to the others before you do your forced update.

提交回复
热议问题