Git Remote Introduction
In this page:
What is a Git Remote?
A remote is simply a copy of your repository hosted somewhere else -- typically on a service like GitHub -- that acts as the shared meeting point where team members exchange commits rather than emailing files back and forth.
Example: What is a Git Remote?
git remote -v
Cloning a Repository
Cloning a repository doesn't just copy its files -- it also automatically configures a remote connection (named origin by default) back to the source, so your local copy already knows where to fetch updates from.
Example: Cloning a Repository
git clone https://github.com/user/repo.git
git remote -v
Pushing to Remotes
Pushing uploads your local commits to a remote, making your work visible to everyone else with access to it -- until you push, your commits exist only on your own machine, invisible to collaborators.
Example: Pushing to Remotes
git push origin main
Pulling from Remotes
Pulling downloads a remote's new commits and merges them into your currently checked-out local branch in one step, which is how you stay in sync with changes teammates have already pushed.
Example: Pulling from Remotes
git pull origin main
Fetch vs Pull
Fetch and pull are related but distinct: fetch only downloads new commits and lets you inspect them before deciding what to do, while pull immediately merges those downloaded commits into your current branch as well.
Example: Fetch vs Pull
git fetch origin
git pull origin main
Chapter Quiz — Complete all 11 topics to unlock
0/11 topics done
Complete these topics first: