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.
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.