Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

19
  • 15
    that does the requested operation, but keep in mind that it will make unhappy those people who already pulled the commits from master.
    – mnagel
    Commented Jul 16, 2013 at 6:13
  • 1
    You shouldn't care about origin/HEAD, simply push the good ref to origin/ref Commented Dec 20, 2013 at 20:53
  • 1
    Agreed, had to do this today after accidentally merging the wrong branches together then pushing to origin. It works well, but it could be very disruptive if other people have been checking out the affected branches from origin. Use with caution.
    – Nick W.
    Commented May 9, 2014 at 1:05
  • 1
    Doesn't work. remote: error: denying non-fast-forward refs/heads/master (you should pull first)
    – m0skit0
    Commented Jan 16, 2015 at 10:36
  • 1
    @m0skit0 It does work. It is your git server who's doing custom magic with git-hooks. This mean you won't be able to reset origin/master. Your only option is to revert changes in a new commit. Commented Jan 17, 2015 at 0:11