Keeping linear history when pulling

suggest change

Rebasing when pulling

If you are pulling in fresh commits from the remote repository and you have local changes on the current branch then git will automatically merge the remote version and your version. If you would like to reduce the number of merges on your branch you can tell git to rebase your commits on the remote version of the branch.

git pull --rebase

Making it the default behavior

To make this the default behavior for newly created branches, type the following command:

git config branch.autosetuprebase always

To change the behavior of an existing branch, use this:

git config branch.BRANCH_NAME.rebase true

And

git pull --no-rebase

To perform a normal merging pull.


Check if fast-forwardable

To only allow fast forwarding the local branch, you can use:

git pull --ff-only

This will display an error when the local branch is not fast-forwardable, and needs to be either rebased or merged with upstream.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents