Go to TogaWare.com Home Page. GNU/Linux Desktop Survival Guide
by Graham Williams
Duck Duck Go



CLICK HERE TO VISIT THE UPDATED SURVIVAL GUIDE

Git Pull

20201117 The default pull behaviour is to perform a merge which can also then create a merge commit, and thus can result in changes being made to the commit history. Whilst this is the original default behaviour of git it is often argued not to be the optional approach.

A pull performs a fetch, to update the local repository with changes to the origin (remote) main repository, and then a merge to reconcile divergent branches.

$ git pull           => git fetch; git merge

A rebase is often prefered whan your local changes are not so significant as to require a separate branch off of whatever branch is currently active (e.g. main or dev). A rebase can be used to reconcile a divergent branch, rather than using a merge, to commit over the remote branch and so as to maintain a single branch both locally and remotely. This avoids the sometime confusion of createing minor branches of branches, and works nicely in team development.

$ git pull --rebase => git fetch; git rebase

There are diverse opinions as to whether to do a merge or a rebase. A rebase is more like the update of earlier version control systems (like Subversion and CVS). It reduces the number of minor branches being merged and so leaves merging as an operation on major branches of activity.

To set the default behaviour (globally) to be a rebase use the config command:

$ git config --global pull.rebase true

The default is:

$ git config --global pull.rebase false

Some recommend the dafault to simply be an attempt at a fast forward over the upstream commits and to fail if that is not possible.

$ git config --global pull.ff only

Further explanations are available from:


Support further development by purchasing the PDF version of the book.
Other online resources include the Data Science Desktop Survival Guide.
Books available on Amazon include Data Mining with Rattle and Essentials of Data Science.
Popular open source software includes rattle and wajig.
Hosted by Togaware, a pioneer of free and open source software since 1984.
Copyright © 1995-2020 Togaware Pty Ltd. Creative Commons ShareAlike V4.