Topic 1

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

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.

Check the current state

Before large edits, look at the repository state.

git status
git pull

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

VS Code source control menu with Pull highlighted

Use a daily sync loop

The loop is:

  1. pull when the remote may have changed
  2. work locally
  3. stage and commit one coherent unit
  4. push the new commit

Keep commits coherent

A good commit collects one understandable change. It does not need to be huge. It only needs to make sense when you read the history later.

Write a short message that names the unit of work before you publish anything to the remote.

VS Code source control panel with a commit message entered

After the commit is ready, push it so the remote history stays aligned with your local work.

VS Code commit menu with Commit & Push highlighted

Before proceeding

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