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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T18:18:19+00:00 2026-05-29T18:18:19+00:00

I did a git rebase master which involved some manual merging in three files.

  • 0

I did a git rebase master which involved some manual merging in three files. In one of them, I missed a trailing newline, resulting in the following at the end of the file:

<<<<<<< HEAD
=======

>>>>>>> ... commit message

which naturally results in a PHP error. I can fix the file easily enough, but I don’t want to add an erroneous “fix sloppy rebase” commit.

How can I amend this change to the rebase? Or, repeat the rebase so I can catch it?

  • 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-29T18:18:21+00:00Added an answer on May 29, 2026 at 6:18 pm

    This question basically boils down to “how do I modify a commit that’s not the most recent?”. Assuming that you haven’t pushed the commit anywhere, and further assuming that history is linear from that commit onwards, it’s pretty easy.

    1. Make the change you want to apply to your earlier commit.
    2. Figure out what the earlier commit you want to modify is. For the sake of these instructions we’ll call it $SHA but you can use any means you want to identify this commit.
    3. Run git commit --fixup $SHA.
    4. Run git rebase -i --autosquash $SHA^

    This will give you an editor with a list of commits. The first commit should be $SHA, the second should be your edit, and following that should be the rest of the commits up to HEAD. Save and close this editor. Git will now do an interactive rebase, applying your change to the commit you wanted to modify.


    There’s an alternative solution you can use, which is a bit more manual, but works without the interactive rebase. Basically, you can checkout the commit you want to modify directly (producing a detached head), make your change, run git commit --amend, and then rebase the branch back on top of your new amended commit. You may actually prefer this style since it’s a bit more explicit about what you’re doing, but the benefit of the interactive rebase version is you can do a lot more things with an interactive rebase. For example, you can reorder commits, squash multiple commits together, delete commits, reword commits, and more. You can also use the --fixup and --squash flags to git commit to record these actions that you wish to perform without actually doing the rebase immediately, and then you can go back and do one big interactive rebase when you’re done.

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

Sidebar

Related Questions

I did a rebase on my branch foo git rebase master Did some conflict
I did git pull origin newbranch:newbranch ... but for some reason.. this tried merging
Here's what I did on my supposed-to-be-stable branch... % git rebase master First, rewinding
1) I did git init in a folder 2) added some project files 3)
I did: git co upstream/master # To no branch. <then did a trivial edit
I had a local branch which was branched off master quite some time ago,
Well.. I did some headless committing and merging and now I am deep in
Copied files & sub-directories into local working directory...then did git add [sub-directory name] Tons
I did a git rebase -i on a commit several nodes earlier. I added
I did : git add remote git@github.com:username/name_of_github_repo.git git push -u github master It returns

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.