Git & GitHub · Daily Workflow

Commit, Push and Pull

Most days you only need five commands — or one panel in VS Code.

Beginner 5 min Lesson 8 of 19Shows Git 2.47 and GitHub.com as of 2026. GitHub changes its layout from time to time; button names stay the same.
Before you start:Cloning a Repository
0/19 in Git & GitHub
On this page · 5 min · Beginner

Learning objectives#

  • Read git status
  • Stage and commit changes
  • Push commits to GitHub
  • Pull other people’s commits

Explanation#

git status tells you which files changed (modified), which are new (untracked) and which are staged. Run it whenever you are unsure.

git add <file> stages a file; git add . stages everything in the folder. git commit -m "message" saves the staged changes as one commit.

git push uploads your commits. If someone else pushed first, Git rejects your push and asks you to pull: git pull downloads their commits and merges them with yours, then you push again.

VS Code does the same in the Source Control panel (Ctrl+Shift+G): click + to stage, type the message, click Commit, then Sync Changes to pull and push in one step.

Step-by-step screens#

Drawings of github.com, the Git installer, VS Code and a terminal. GitHub changes its layout from time to time; the button names stay the same. The red numbers match the numbered actions under each picture; names on your computer will differ.

Loading pictures…

Code example: One round of the daily loop#

ShellOne round of the daily loop Illustrative
git pull                         # start with the latest version
# ...edit index.html and add contact.html...
git status
git add .
git commit -m "Add contact page"
git push
Expected output
Already up to date.
On branch main
Changes not staged for commit:
        modified:   index.html
Untracked files:
        contact.html
[main 7c1d9e2] Add contact page
 2 files changed, 24 insertions(+)
To https://github.com/asha/hello-github.git
   3f9c2a1..7c1d9e2  main -> main

This example is illustrative. Copy or download it and run it in your own environment; the expected output is shown above.

Step-by-step explanation#

  1. pull first so you build on the latest code.
  2. status shows one modified and one new file.
  3. add . stages both.
  4. commit saves them with a message.
  5. push uploads the new commit to GitHub.

Real-world use case#

Two friends build a website together: each pulls in the morning, commits small changes and pushes several times a day, so their work rarely collides.

Common mistakes#

“Updates were rejected” when pushing

Someone pushed first. Run git pull, fix any conflict, then push again — never use --force on a shared branch.

git add . with junk files

Logs, node_modules and .env get committed. Add a .gitignore before the first commit.

Best practices#

  • Pull before you start
  • Commit small and often
  • Read git status before committing
  • Push at the end of each work session

Remember this#

status → add → commit → push.

Rejected push? pull, then push.

VS Code: + , message, Commit, Sync.

Practice exercise#

Your task: Stage only README.md and commit it with the message “Update README”.

Show solution
Shell Illustrative
git add README.md
git commit -m "Update README"

Mini quiz#

Commit, Push and Pull quizMultiple choice Question 1 of 2

Your push is rejected because the remote has new commits. What do you do first?

Score so far: 0/0

Want more? Practise all Git & GitHub MCQs · Git & GitHub interview questions

My notes#

Saved in this browser.

Progress is saved in this browser. Sign in to sync.