What exactly does a git pull --rebase does

git

Solution

When you `git pull --rebase`, a few things happen:

`git fetch origin master`

-just using origin/master as an example

`git rebase origin/master`

- moves all of your commits after the commits on origin/master

At this point, you can now push to origin and your commits will be applied on top of all other commits cleanly.

Without the `--rebase` flag, you'd end up with a merge commit; one that has two parents: your master branch and the work on origin/master

Here are a few helpful resources:

- http://viget.com/extend/only-you-can-prevent-git-merge-commits

- http://gitready.com/advanced/2009/02/11/pull-with-rebase.html

Problem

What exactly happens when I run the command `git pull --rebase` on master branch Does this rewrite my master branch history Is it a good way to pull changes or should we ``` 1. Git fetch 2. Git merge ```

Original source

Related problems