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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:28:30+00:00 2026-05-14T03:28:30+00:00

I made 5 commits to Master branch when bug hunting on a private project

  • 0

I made 5 commits to Master branch when bug hunting on a private project and pushed them to the remote origin (my own private vps).

Then I saw that commits 4 and 5 were going to cause trouble elsewhere and I need to undo them, so I checked out commit 3 again, made a new branch “Dev” from that point, and did a few more commits fixing the issue properly.

Then I did

git reset –hard HEAD~2 on Master to pull it back to the point that I branched Dev.

Then I did git merge to fast forward Master back to the end of the Dev branch.

So now I have a local repository, with Dev and Master both pointing to the same, up to date version of the project with the latest bug fix.

Problem is, when I try to push the project now to the origin, it fails and gives me an error message:

! [rejected] master -> master (non-fast forward)
error: failed to push some refs to ‘myserver…myproject.git’

What have I done wrong, and how do I fix it?

Thanks

  • 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-14T03:28:31+00:00Added an answer on May 14, 2026 at 3:28 am

    It just doesn’t like the fact that the branch you’re pushing to isn’t an ancestor of what you’re pushing.

    If you’re certain you want to do that, just add the -f flag (force) to the push.

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

Sidebar

Related Questions

I have made several commits in the master branch and then merged them to
I created a topic branch from the master; made some commits. Then checked out
I have some unwanted commits in master branch, I've made a branch say, new_branch
I created an experimental branch from master, and made four commits on the experimental
I accidentally made 10 commits on branch testing when I intended to commit them
I made a series of commits after a good commit on the master branch,
I have made commits to my local branch (let's just say master) and have
i have an open source ruby project on github, where my master branch represents
I have a repository in Git. I made a branch, then did some changes
How can I view any local commits I've made, that haven't yet been pushed

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.