Rebase, without ignoring, commits the same text changes?
The page mask git rebase
reads:
If
<upstream>
not specified, the upstream parameters configured in parametersbranch.<name>.remote
and will be usedbranch.<name>.merge
;[....]
The entries that were previously saved to the temporary area are then overwritten to the current branch in order. Note that any commits in
HEAD
that introduce the same textual changes as commit inHEAD..<upstream>
are skipped (i.e. a patch already accepted upstream with a different commit message or timestamp will be skipped).
Indeed, when I call git rebase master
and master
there is a commit with the same text changes as in my local branch history, it is ignored. However, I found that when I call git rebase
without specifying <upstream>
(which is by default master
), the output git rebase
seems to show that the same commit is not being ignored.
Example
Here's an example to demonstrate this. Here is the git history:
A---B master
\
B' topic
B
and B'
introduce the same text changes but have different commit messages. topic
configured for tracking master
.
First, I reinstall topic
on feed <upstream>
:
$ git checkout topic
$ git rebase master
First, rewinding head to replay your work on top of it...
Nothing happens as expected because B
both B'
are identical to each other.
However, if I omit <upstream>
:
$ git checkout topic
$ git rebase
First, rewinding head to replay your work on top of it...
Applying: Branch: topic
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
It seems that git doesn't skip B'
in the second output. Can anyone explain this discrepancy?
(I am using git version 1.9.4)
source to share
No one has answered this question yet
Check out similar questions: