Skip to content

Push and pull

Working with remotes · Article 5 of 9 · 2 min read

Remotes are how your commits reach other people and other machines.

The short version

A remote is a copy of your repository hosted somewhere else, usually GitHub. git push sends your commits to it. git pull brings new commits from it into your branch.

Details

By convention the main remote is called origin. The first push of a branch needs -u so Git remembers which remote branch to track.

Try it yourself

Create an empty repository on GitHub, then run:

git remote add origin https://github.com/YOUR_NAME/duck-notes.git
git push -u origin main
git pull

Refresh the GitHub page and you should see your files. git pull should report that everything is up to date.

Explain it to the duck

What is the difference between a local branch and the remote branch it tracks?

Tested with: Git 2.51 and GitHub.