git fetch does not change the state of the working tree. In fact, this does not require a working tree: git fetch can work in an open repository (a repository that does not have a working tree).
Susan commit creates a new object in its repository. This object is not known in your workspace until you perform the extraction. At this moment, this object becomes available in your space. Since this object is identified by its hash, which is a very large integer, it almost certainly differs from (does not collide) with any other object that you already have.
In addition to fetching the new commit, git fetch also update the remote branch pointers. For example, suppose the Susan master and your branch were identical before the Susan commit. After Susan completes, her branch has a new commit that you don’t have. When you do git fetch , your local origin/master branch pointer is updated to indicate that its head is now executed by Susan. However, the local master branch remains unchanged.
At this point, you can run git checkout (without arguments) and you will get a message like branch master is behind origin/master by 1 commit and can be fast-forwarded . This comes from comparing master and origin/master .
You can now integrate with Susan's changes in several ways:
git rebase : cherry pick changes that are only in your local master on top of new changes in origin/master (thereby rewriting their history), and make the result a new HEAD on the local master ). After that, master strictly ahead of origin/master : this is the same as origin/master , plus your changes.git merge : keep your changes intact and create a new commit to master that collapses them and merges them. This commit has two parents: the previous commit to master (in this case, Susan commit) and the last commit in your series of local commits in their original form. Again, master now strictly ahead of origin/master .git reset --hard origin/master : In recognition of Susan’s commitment to make all of your work obsolete, you drop your work and simply redirect your local master to replace Susan. Now master is identical to origin/master .
The first two actions are combined with git fetch using the git pull command. git pull does either git fetch followed by git merge , or git fetch does git rebase . Behavior is configured for each branch, and there is a global option by which to configure the newly created branches. You can override the behavior with git pull --rebase or git pull --merge .
Since your local changes are not being implemented, you will not be able to take these integrating actions (reboot or merge). Git wants to convert your changes to commit first. There is no interaction between recently selected objects and you commit from local changes.
Now you do not need to take any action. Thanks to git fetch you are informed of upstream activities without the need to integrate immediately with them. You can, for example, do git log origin/master to find out what's new and how it might affect your work. But you can put it aside and keep making new commits.