Topic 2

Pull & Push

Keep the daily remote workflow small: pull before work if needed, commit coherent changes, then push when the work unit is ready.

Pull and push workflow overview

Key terms

Term Meaning
Stage The process of preparing changes to be included in a commit, before actually committing them.
Commit The operation of saving changes to the local Git repository.
Push The action of transferring commits from the local Git repository to a remote repository.
Pull The action of fetching commits from a remote repository and merging them into the local branch.

Pull (first way)

Let’s learn how to download what’s uploaded to GitHub to the registered folder.

Click the button on the right and select ‘Pull’ in Source Control.

VS Code Source Control pull menu
VS Code Source Control menu with Pull highlighted

When the pull is successfully completed, you will be able to see the following screen.

If nobody else has changed the repository, the pull does nothing — that is expected.

VS Code Source Control after pull completes

Pull (second way)

Open a new terminal with Ctrl + Shift + ` on Windows or Cmd + Shift + ` on macOS. Then enter the following command:

git pull

Pull (third way)

You can also perform Pull commands from the Command Palette with Ctrl + Shift + P on Windows or Cmd + Shift + P on macOS.

VS Code Command Palette pull command

Push (first way)

You can upload the changes to GitHub by staging them, committing, and then pushing.

Click the ‘+’ button in Source Control.

VS Code Source Control plus button for staging changes

You will see the Staged Changes appear.

VS Code source control panel with staged changes

Enter the commit message.

VS Code source control panel with a commit message entered

Click the button on the right.

VS Code Source Control commit button menu

Select ‘Commit & Push’.

VS Code Source Control Commit & Push option

Push (second way)

Open a new terminal with Ctrl + Shift + ` on Windows or Cmd + Shift + ` on macOS. Then enter the following command:

git add .
git commit -m "Describe your change"
git push

Push (third way)

You can also perform Push commands from the Command Palette with Ctrl + Shift + P on Windows or Cmd + Shift + P on macOS.

VS Code Command Palette push command

If you can explain when to pull, when to commit, and when to push without improvising, your daily sync loop is ready.