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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:54:41+00:00 2026-06-01T08:54:41+00:00

I pushed some changes to our central git repository, and then immediately realized that

  • 0

I pushed some changes to our central git repository, and then immediately realized that I had an old, now obsolete change lying around, and that I had introduced a merge with it:

before

I then used git rebase to get rid of this spurious parent:

after

Then I pushed this with git push -f to origin. It answers with “everything up-to-date”.

Now I would expect the central repository to match what I have locally. However, when I clone the project anew, I still have the spurious parent inside. What’s worse is that git wants to merge, and if I let it do that, I get my latest commit twice (once with the old hash, and once with the new one after rebasing).

How do I get git to push what I have without merging, and just take my repository state as the new state (so basically, to reject all remote differences)?

or am I doing this wrong? I want to get rid of the “When reading a property…” commit, and the whole red line in the upper image.

  • 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-06-01T08:54:42+00:00Added an answer on June 1, 2026 at 8:54 am

    You can solve this in various ways. One way is to reconstruct the history locally by using reset, stash and commit. The following will undo your last commit (Initial import of the…) and stash away those changes.

    git reset --mixed HEAD^
    git stash
    

    Now you can reset your master to the commit you had before you did the merge, assuming abcd1234 is the hash of the “Testing git.” commit:

    git reset --hard abcd1234
    

    Now bring back the stash and commit it again:

    git stash pop
    git add .
    git commit -m 'Initial import of the C++ client library.'
    

    Now finally push up your rewritten master:

    git push -f origin master
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I forked a GitHub repository. Then I pushed some changes to my fork. Then
I have forked a git repository and setup upstream. I've made some changes in
I had a mistake and commit some changes to git which I should not
I forked someone elses repository on Bitbucket and made some changes (and pushed them
My colleague has pushed to our git repository a mistake. I wish to commit
A few minutes ago, I commited some files and then pushed them to my
I created a local Git repo on my laptop and then pushed the source
Yesterday we pushed out some changes including the addition of ASP.NET MVC 3 (routing,
I forked some project and cloned it locally. Changed files, commited changes, pushed changes
I forked a project on GitHub, pushed some changes, and opened a pull request.

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.