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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:51:34+00:00 2026-06-12T22:51:34+00:00

I have encountered an interesting issue in which I have my master trying to

  • 0

I have encountered an interesting issue in which I have my master trying to catch up with an upstream branch. However I want to test my master at specific points along the way so I ensure I only rebase upstream onto master at certain points.

Assume the following state:

          --F--G--H--> master
         /
        /
----A--B--C--D--E--I--J--> upstream

I want first to rebase C and D and then test. So I do:

$ git checkout upstream
$ git checkout D
$ git checkout -b upstreamD
$ git rebase -i master
$ git checkout master
$ git merge upstreamD

This shows me C and D to rebase. After successful rebase I have:

          --F--G--H--C--D--> master
         /
        /
----A--B--C--D--E--I--J--> upstream
             ^
         upstreamD

Then I removed upstream cause I didn’t need it anymore while testing, etc (cause I can always get it).

$ git branch -d upstreamD
$ git branch -d upstream
$ git remote rm upstream

I do my testing and since everything is fine I go back and grab my upstream using a newly created remote and put its master in branch upstream.

So, now I think I have something like (notice master and upstream have more commits):

          --F--G--H--C--D--K--L--> master
         /
        /
----A--B--C--D--E--I--J--M--N--> upstream

And I want to rebase a bit more so I execute the same procedure above:

$ git checkout upstream
$ git checkout J
$ git checkout -b upstreamJ
$ git rebase -i master

However, now I get to rebase something like: C, E, I, J. The strange thing is that I was only expecting E, I, J. C is in master already (even if under a different SHA1, since history is different).

In http://www.kernel.org/pub/software/scm/git/docs/git-rebase.html it says and I quote:

If the upstream branch already contains a change you have made (e.g.,
because you mailed a patch which was applied upstream), then that
commit will be skipped.

I couldn’t find anywhere where it explains how git performs this skipping. How does it check that C is already in master or not, and why does it decide that C should be rebased again and D shouldn’t?

  • 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-12T22:51:35+00:00Added an answer on June 12, 2026 at 10:51 pm

    From git-rebase(1):

    Note that any commits in HEAD which introduce the same textual changes as a commit in HEAD.. are omitted (i.e., a patch already accepted upstream with a different commit message or timestamp will be skipped).

    (Which seems to be implemented via git format-patch, specifically the --ignore-if-in-upstream option.)

    This means that the patches must be textually identical (only the patches, not the commit metadata or SHA id’s, etc.) for rebase to skip them automatically.

    I suspect in your example above that commit C likely had a conflict which you had to resolve; as a result of this the patches would be different. If commit D did not conflict, it would still be textually identical, hence why rebase skipped it when it did not skip C.

    In my opinion the best way to handle this scenario is to use the --onto option for git rebase, like so:

    git rebase --onto master D
    

    Where D is the last commit you rebased. There are other ways; rebasing interactively and removing the commits that you know already exist is one.

    I consider the automatic skipping logic of git rebase to be a “best effort” one; when it works it’s great, but as you’ve seen you have to be prepared for the cases when it doesn’t.

    HTH.

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

Sidebar

Related Questions

I have encountered an interesting issue I could not find posted elsewhere. Take a
I have encountered an interesting issue on Windows 8. I tested I can represent
Today I encountered interesting issue. That's what I have: 2 images with humanoids on
I have encountered a problem in one of my Java projects, which causes bugs.
I encountered an interesting problem today which I thought was not possible in Java.
I encountered an interesting thing today that I have never noticed before. It appears
I've encountered an interesting problem. I have a div that is a container around
In searching for an answer to an interesting situation which I had recently encountered
I have encountered strange issue with lists in F#. I am using XamlXmlReader to
I have encountered a problem when trying to select data from a table in

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.