开发者

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开发者_StackOverflow中文版 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:

  • Why does git-rebase give me merge conflicts when all I'm doing is squashing commits? Conflicts with `git rebase`


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`


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

  • http://gitready.com/advanced/2009/02/11/pull-with-rebase.html
  • http://longair.net/blog/2009/04/16/git-fetch-and-merge/
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜