Why does git pull --rebase fail when replaying exi

2019-06-21 18:24发布

问题:

I don't get this: when I 'git pull --rebase remote branch' it reverts my HEAD back to their shared root and then starts replaying all of the remote commits that have happened in the meantime. Why do these commits sometimes fail? They are clean commits on a clean workspace? Isn't that almost the point of rebasing?

回答1:

Are you sure it isn't your commits failing?

Suppose you are working on a branch and make a bunch of changes to a specific file.

Now you want to rebase your commits on to whatever the head of the remote is.

All of your changes are removed, then all of theirs are applied, then all of your changes are re-applied on top of that. So what if they deleted the file you're working on? Or otherwise made changes that make your changes impossible to apply?