Taco Steemers

A personal blog.
☼ / ☾

Git pull without merge

Applying remote changes to our local branch without an additional merge commit

The problem

I want to update my local git branch based on the changes that are on the remote branch. If I just do git pull , I will need to do a merge. I don't want to get an additional commit just for merging. Instead, I want my local changes to be applied on top of the changes that have been made to the remote branch.

A solution

git pull --rebase

There will be no additional commit for merging. Instead, the changes required to merge your changes with the remote branch will be made to your local commits. Now it looks like the branch has always been based on the current state of the remote branch.


This is what we call rebasing . One might say that the state we base our changes on is re -done.

There is also interactive rebasing, but that is a different topic.

We should not do git pull --rebase on the same main branch that other people are pushing work in progress to as well. That will get messy really fast. One proper way to handle that type of situation is to use a feature branch workflow .