AtomLearnAtomLearn
DashboardGoalsPathAchievementsReviewSign In
DashboardGit & Version ControlRemotes, GitHub & Push/Pull
Git & Version ControlNot Started

Remotes, GitHub & Push/Pull

Clone repos, push your work to GitHub, pull teammates' changes, and understand fetch vs pull

0%
Knowledge0%
Learn & Drill
Fluency0%
Drill & Speed
Retention0%
Mastery & Review
Confidence0%
All modes
Practice
Knowledge
Fluency
Retention

Knowledge Debt detected

You can study this freely — but your score may plateau if these foundations have gaps. The Mastery badge requires them to be solid.

Explanation

A is simply a URL your local repo knows about.

Clone an existing repo

bash
git clone https://github.com/user/repo.git
# Creates a local copy with 'origin' pointing back to GitHub

Check remotes

bash
git remote -v   # list remotes and their URLs
# origin  https://github.com/user/repo.git (fetch)
# origin  https://github.com/user/repo.git (push)

Push your branch

bash
git push origin feature-login        # push the branch
git push -u origin feature-login     # push + set upstream (do once)
git push                             # after upstream is set, just this

Fetch vs Pull

bash
git fetch origin        # download remote changes — does NOT modify your branch
git pull                # fetch + merge into your current branch
git pull --rebase       # fetch + rebase (cleaner history)

Prefer `git fetch` then inspect before merging — it lets you see what changed before it touches your work.

Examples

First push of a new branch

The -u flag (set upstream) links your local branch to the remote branch so future git push and git pull know where to go.

git switch -c feature-payment
# ... make commits ...
git push -u origin feature-payment
# Sets 'origin/feature-payment' as the upstream
# Future: just 'git push'

Sync with teammates before starting work

Always sync before branching off main so your feature branch starts from the latest code.

git switch main
git fetch origin           # download new commits
git log origin/main        # inspect what changed
git merge origin/main      # apply — or: git pull does both
# Now your main is up to date

How well did you understand this?

Next in Git & Version Control

Team Workflows & Best Practices

Continue