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.
Outcome
Local and GitHub history contain the same completed commit after one pull and push cycle.
Before you start
- The terminal is inside the intended repository and branch.
- Local changes have been reviewed and committed before pushing.
Verification state
- Status
- Needs review
- Environment
- Command-line behavior applies across platforms; screenshots also show Windows VS Code and GitHub Desktop paths.
- Workflow
- Pull and push through Git, VS Code, and GitHub Desktop.
- Last verified
- Pending a current-product walkthrough.
- Operating-system support
- Git commands support Windows, macOS, and Linux; graphical controls differ by product and platform.
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.
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.
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.
Push (first way)
You can upload the changes to GitHub by staging them, committing, and then pushing.
Click the ‘+’ button in Source Control.
You will see the Staged Changes appear.
Enter the commit message.
Click the button on the right.
Select ‘Commit & Push’.
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.
If you can explain when to pull, when to commit, and when to push without improvising, your daily sync loop is ready.
Common problems
- Pulling with uncommitted overlapping changes can block the sync and require cleanup first.
- A rejected push usually means remote commits must be pulled and reviewed before retrying.
Completion check
git status reports a clean working tree and the local branch is up to date with its remote branch.