Fetch vs Pull with Visual Studio Code

Posted by

There comes a time when you have others with access to modify or add to your repository that changes occur from the central repo and your workstation repo.  In this article, I will quickly show how to use the fetch and pull commands to update your local repo with modifications made to the central repo.

If you are looking for an example of how to do this in Git Bash please go to this URL:
https://digitalthoughtdisruption.com/2020/09/09/fetch-vs-pull-with-git-bash/

In my example I have modified one of the examplefiles in GitHub and added a new file called filesavedtogithub.txt.

Fetch vs Pull:

fetch

Downloads new data from a remote repository (GitHub in our examples).  However, it doesn’t integrate any of the new data into the working files. Fetch is ideal for receiving a view of the modifications that has occurred at the remote repo.

pull

Updates your current head branch with the latest modifications from the remote repo.  As part of the pull process and pulling down of new data, it also merges the new data into your current files, which can have negative outcomes.

As you can see from my local workstation the new file isn’t here and the date modified for the sample text file is earlier today

As you can see from the explorer none of the changes made to the GitHub have been updated in VS Code.

As you can see it is indicating there are two changes that need to be pulled down from the remote repo

Now you can click on the synchronize button

Press OK

As you can see the addition line of information was added to the sample text.ps1 file and the new filesavedtohithub,txt is in the folder

Summary:
As you can see it is not hard to push and pull data via VS Code.  This is one reason why it is my preferred editor.  As always, I hope y’all found this article useful.

2 comments

Leave a Reply