Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6057563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:30:08+00:00 2026-05-23T08:30:08+00:00

I have performed git commit followed by a git push . How can I

  • 0

I have performed git commit followed by a git push. How can I revert that change on both local and remote repositories?

$ git log
commit 364705c23011b0fc6a7ca2d80c86cef4a7c4db7ac8
Author: Michael Silver <Michael Silver@gmail.com>
Date:   Tue Jun 11 12:24:23 2011 -0700
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:30:09+00:00Added an answer on May 23, 2026 at 8:30 am
    git reset --hard HEAD~1
    git push -f <remote> <branch>
    

    (Example push: git push -f origin bugfix/bug123)

    This will undo the last commit and push the updated history to the remote. You need to pass the -f because you’re replacing upstream history in the remote.

    Edit:

    Please note that --hard will make your commit unreachable (i.e. it will appear to be deleted, but you can still git show <hash> or git log <hash> it if you remember its hash). If you want to keep your changes, run:

    git reset [--mixed] HEAD~1
    

    At this point you have unstaged changes because you used --mixed, which is the default.

    You may first want to update the remote tree first (i.e. remove the commit): git push -f <remote> <branch>

    Since you still have your changes locally you can create another branch and commit them there (and push as you see fit).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a local branch that is tracking of a remote branch on git.
I'm using a local Git project repository, and have created a remote repository followed
I have a set of GIT repositories that I always have different activities on
I have a remote git repository where I have a tag (tag-1) that is
I have just performed git add --interactive , so the index version of some
I have a fresh git-svn repo (11.13 GB) that has over a 100,000 objects
I suspect I have performed an incorrect amendment (B') of last commit (B), which
I have git repositories rA and rB, I would like to copy only specific
I have asked Git to perform a commit from within git bash, It has
I have a commit template set up for git, and I would like to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.