Git Push Revert
Results 1 to 4 of 4

Thread: Git Push Revert

  1. #1
    Junior Member
    Join Date
    Apr 2012
    Posts
    4

    Git Push Revert

    Hi there, apologies if I've posted this in the wrong section but I was sort of unsure where a question like this would go.

    I've just made and pushed a commit using Git that I didn't mean to push to the master branch. The push was meant to go to a test branch to be reviewed but instead is now on the live master branch.

    I need to undo this and get it off the master asap, and I'm having a lot of trouble doing this.

    I've tried git revert <hashcode>, git push origin <hashcode>, and git reset <hashcode> hard but none of them remove the changes from the master branch!

    What should I do?

  2. #2
    Pedantic Curmudgeon Weedpacket's Avatar
    Join Date
    Aug 2002
    Location
    General Systems Vehicle "Thrilled To Be Here"
    Posts
    21,885
    Quote Originally Posted by saricDen
    Hi there, apologies if I've posted this in the wrong section but I was sort of unsure where a question like this would go.
    Since it doesn't appear to have anything to do with PHP, I've moved it to the Echo Lounge.
    THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER
    FAQs! FAQs! FAQs! Most forums have them!
    Search - Debugging 101 - Collected Solutions - General Guidelines - Getting help at all

  3. #3
    PHP Witch laserlight's Avatar
    Join Date
    Apr 2003
    Location
    Singapore
    Posts
    13,563
    Quote Originally Posted by saricDen
    I've tried git revert <hashcode>, git push origin <hashcode>, and git reset <hashcode> hard but none of them remove the changes from the master branch!

    What should I do?
    First do a git revert, then do a git push to push the commit that reverts the mistaken commit.

    I believe that you could also do a reset to the previous commit and then do a forced push, but that is generally not a good idea if other people may also pull from that master branch.
    Use Bazaar for your version control system
    Read the PHP Spellbook
    Learn How To Ask Questions The Smart Way

  4. #4
    Junior Member
    Join Date
    Apr 2012
    Posts
    4
    Quote Originally Posted by laserlight View Post
    First do a git revert, then do a git push to push the commit that reverts the mistaken commit.

    I believe that you could also do a reset to the previous commit and then do a forced push, but that is generally not a good idea if other people may also pull from that master branch.
    Thanks very much! I think the problem is solved, I really appreciate it.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •