Reputation: 1705
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
Upvotes: 4
Views: 412
Reputation: 3483
When you git pull --rebase
, a few things happen:
git fetch origin master
-just using origin/master as an example
git rebase 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:
Upvotes: 3