Lawrence I. Siden
Lawrence I. Siden

Reputation: 9369

Why does git-rebase encounter conflicts when upstream is already reachable?

I have a git branch "dev". Branch "master" is reachable from dev. While on branch "dev", if I type "git log master..dev --pretty=oneline" it clearly shows that master is reachable (104 commits earlier). But if I type "git rebase master", it will stop with conflicts. Why is that? Shouldn't rebase have nothing to do in this case, since dev is already based on master?

The reason I am asking this is because I really want to do an interactive rebase with squashes and rewords to clean up a lengthy history. But I am put off by having to resolve all the conflicts that should have already been resolved once I start the rebase.

The following are some related questions that I've already looked at:

Upvotes: 4

Views: 395

Answers (2)

sehe
sehe

Reputation: 393134

rebase != merge

If you just want to fast forward, use

git pull --ff-only ...
git merge --ff-only ...

If you want to 'automatically rebase/fastforward' depending on the current context and relationship of your branches, I suppose this would work:

git pull --rebase ...

You may want to read the man page on what it does, precisely

Upvotes: 0

Karl Bielefeldt
Karl Bielefeldt

Reputation: 49078

git rebase master rebases your branch to be based off the latest commit in master. If you want to base it off something earlier, you need to specify the exact commit, i.e.

git rebase `git merge-base master HEAD`

Upvotes: 1

Related Questions