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

  • Home
  • SEARCH
  • 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 6752937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:06:09+00:00 2026-05-26T13:06:09+00:00

We have a problem with our git project: bad changes were pushed to the

  • 0

We have a problem with our git project:

  • bad changes were pushed to the remote repository
  • one machine has not pull-ed the bad changes, but has uncommitted local changes

We want to get rid of the bad changes from the remote repository, and then push the good changes.

We’re not very experienced with git, and are afraid of screwing it up and losing the uncommitted, good changes. We’re not sure whether we need to use git revert or git rebase (or something else), and from which computer (i.e. from one that doesn’t have the good changes?).

  • 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-26T13:06:09+00:00Added an answer on May 26, 2026 at 1:06 pm

    First off: Don’t panic

    This is a revision control system. It exists so you can’t easily loose information.

    You can always save the work first:

    git checkout -b RESCUE_THIS
    git add .
    git commit -am 'Do not loose this commit!'
    

    and take it from there.

    I suggest:

    1. revert the bad commit

      • git reset HEAD@{1} # if it was the last commit

        you need to work out which changes you DO want to keep and potentially commit them into a new commit. Note use git reflog to find the ‘HEAD@{1}part that you want. Take your time as this can be a bit confusing when comparing togit log`

      • git revert bad-commit-id # if it wasn’t

        Note locate the revisions to revert with git log. You can revert multiple commits. Revert them in reverse chronological order. Each revert will result in a new commit that ‘undoes’ the chances from that commit.
        If you find yourself reverting plenty commits, you might want to rebase instead.

    2. force push the fixed branch to the central repo

      • git push -f # perhaps specify branch: origin master or similar
    3. restore any remaining work form the ‘good’ client, e.g. by

      • git checkout master # switch back from RESCUE_THIS

      • git merge –no-commit –ff RESCUE_THIS

      • git commit -am

      • git push # when you are truly satisfied with the result

    By that time you could opt to delete the RESCUE_THIS branch. Even if you do, it will not actually disappear until the reflog(s) expire.

    Disclaimer: all the above is rife with assumptions about your setup, branch history, workflow, and particular failure scenario. Rest assured, they are educated guesses and most of the time coincide with common practice. Keep your eyes open and think it over for yourself, though. As a last resort, you can take a physical backup of the git repo on the ‘good client’ for safety

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

Sidebar

Related Questions

We have the problem that we have the open project files in our SVN
We have encountered a very strange class not found problem in our web app
We have a problem/misunderstanding with our current git setup. We have local master and
We have a problem in our swing based application since we've upgraded our java
I'm trying to get a handle on whether we have a problem in our
So here is our problem: We have a small team of developers with their
We have a common problem of moving our development SQL 2005 database onto shared
We have an x-files problem with our .NET application. Or, rather, hybrid Win32 and
I have a problem. Actually in our application, earlier the customer was allowed to
I have a problem with the code analysis rule CA1726:UsePreferredTerms . Our business domain

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.