My work flow to contribute to a repo, is
Sometimes while I am working on my change, other devs might commit their changes into the upstream, so I want to do a rebase which will bring my fork up to date. But I have noticed that in the below scenario, Rebase and Merge Commit gave me different response,
The way I tested it is as follow:
upstream/master
is the branch in the upstream, and muti/master
is the branch in my fork.My question is, why rebase doesn't detect any change, while the merge and commit does?
Note first that if you have access to the upstream
repository, you don't have to fork it in order to push a fix branch and initiate a PR (Pull Request).
You can do all that directly in the upstream repository.
Second, the rebase would only work if the current branch has a divergent history from upstream/master
.
If the current branch HEAD is an ancestor of upstream/master
, the rebase (of the current branch on top of upstream/master
) would be a no-op.
But a merge (of upstream/master
into the current branch) would not, since from the point of view of the current branch, there is one commit (done in upstream/master) that it does not have.