Usually when you develop on some feature, you create a dedicated branch that starts from your main development line, usually master
. However, the longer you work on your feature branch, the bigger the final merge will be. In this lesson we’re going to take a look at how you can regularly update your feature branch with the latest changes by using rebase
.
Hello,
what about "git pull origin master" method? how is this method compared to those that you mentioned in this lecture?
git pull
synchronizes your local branch with the according remote. If you pushed that branch to some remote repository (e.g. GitHub or Gitlab,...) before, it usually has a remote counterpart registered on it. So if you are on master
and do a git pull
(or git pull origin master
) it would pull down the latest changes and update your master branch.
In this lecture I showcase how to update your feature branch with what happened in master since you last branched off. In specific, using rebase
rather than merge
. By pulling master first, and then switching to the feature branch and executing git rebase master
, I'm synchronizing my local feature branch with what is in the master
branch.
So we cannot really compare git pull
with git rebase
as they are two different things.