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 7671315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:01:19+00:00 2026-05-31T16:01:19+00:00

I just squashed some commits with git rebase and did a git push –force

  • 0

I just squashed some commits with git rebase and did a git push --force (which is evil, I know).

Now the other software engineers have a different history and when they do a git pull, Git will merge. Is there a way to fix this, except doing a rm my-repo; git clone git@example.org:my-repo.git?

I need something like the opposite of git push --force, but git pull --force did not give the intended results.

  • 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-31T16:01:20+00:00Added an answer on May 31, 2026 at 4:01 pm

    To receive the new commits

    git fetch
    

    Reset

    You can reset the commit for a local branch using git reset.

    To change the commit of a local branch:

    git reset origin/main --hard
    

    Be careful though, as the documentation puts it:

    Resets the index and working tree. Any changes to tracked files in the working tree since <commit> are discarded.

    If you want to actually keep whatever changes you’ve got locally – do a --soft reset instead. Which will update the commit history for the branch, but not change any files in the working directory (and you can then commit them).

    Rebase

    You can replay your local commits on top of any other commit/branch using git rebase:

    git rebase -i origin/main
    

    This will invoke rebase in interactive mode where you can choose how to apply each individual commit that isn’t in the history you are rebasing on top of.

    If the commits you removed (with git push -f) have already been pulled into the local history, they will be listed as commits that will be reapplied – they would need to be deleted as part of the rebase or they will simply be re-included into the history for the branch – and reappear in the remote history on the next push.

    Use the help git command --help for more details and examples on any of the above (or other) commands.

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

Sidebar

Related Questions

I think I squashed the last 40 commits using rebase. I was following this
We have a Git repository with over 400 commits, the first couple dozen of
Just looking for some advice on the best to approach a profile picture system
Just from Curiosity... If I alter a pointer to point to an other autoreleased
Just opening a WPF solution (not a winforms or any other solution) will cause
just getting myself familiar with jquery, please consider me as a noob for now.
Just what the title says, I need to change the password for an existing
Just looking for the first step basic solution here that keeps the honest people
just a quick question: I am a CS undergrad and have only had experience
Just bought a 2.4GHz Intel Core 2 Duo iMac with 2GB of memory and

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.