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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:35:38+00:00 2026-06-01T17:35:38+00:00

Basically, I have an open pull request that I want to fix and at

  • 0

Basically, I have an open pull request that I want to fix and at the same time I want to make 1 commit that contains 2 features into 2 seperate commits.

Github repository now looks like this where fix is a new branch:

master c-c-c
            \
     fix c-c-c-c

I created a pull request from fix.

I wanted to change the last commit in fix into 2 commits in my local repository as follows:

master c-c-c
            \
     fix c-c-c-n-n

where n-n are my 2 new commits.

To get to this point locally, I did this:

1. git rebase -i HEAD~2
2. Changed my last commit line to "edit", saved and closed the file
3. git reset HEAD^
4. git stash save
5. Removed the changes I don't want in the first commit
6. git commit -m "commit a" -a
7. git stash apply
8. git commit -m "commit b"

So now I have 2 commits the way I want. The problem is I found a bug that ended up in the pull request. Since I have already pushed to the remote repository, it won’t accept my new commits (as the original one is now missing).

I run:

git push origin fix --dry-run

and I get the message:

To git@github.com:<UserName>/<Repository>.git
! [rejected]        fix -> fix (non-fast-forward)
error: failed to push some refs to 'git@github.com:<UserName>/<Repository>.git'

I have seen other posts suggest to pull my changes from origin before pushing back again, but won’t that basically reset my 2 commits back into the one?

Ideally, what I would like to do is assign the same commit ID to the last commit so it can replace the current one as is. Is there a way to do that? (Note that I didn’t run git reset with --hard)

  • 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-01T17:35:39+00:00Added an answer on June 1, 2026 at 5:35 pm

    When faced with that problem, a force push has worked for me:

    git push --force origin fix
    

    EDIT: Per comments below, --force-with-lease is preferred over a direct --force because it includes some protections in case there has been an intervening commit. This article describes it as "–force with a seatbelt".

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

Sidebar

Related Questions

I basically have a div on my site that always has the same stuff.
Basically I have a script in Python that grabs the text from an open
I basically have three tables, posts, images and postimages (this simply contains the ids
I basically have 7 select statements that I need to have the results output
I basically have the same question as this guy .. The example in the
I have this error that is keeping me from moving forward. I basically have
Basically I have converted a tab delimited txt file into a list containing a
Basically I have a div at the very top of my site that I
Ok so basically I have a csv file with different values. I want each
The log reports that the database or cursor was not closed. I basically have

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.