โ† Git Essentials

Remotes and Collaboration

~250 words ยท 2 min read

What is a remote?

A remote is a copy of your repository hosted somewhere else โ€” usually GitHub, GitLab, or a private server. The default remote is conventionally named origin.

Cloning

git clone https://github.com/user/project.git

This downloads the full history, creates a local repository, and automatically sets up origin pointing at the URL you cloned from.

Push and pull

git push origin main     # upload your commits
git pull origin main     # download + merge others' commits

Push sends your local commits to the remote. Pull fetches remote commits and merges them into your current branch.

The daily loop

  1. git pull โ€” get the latest from your team.
  2. Work on a feature branch.
  3. Commit your changes.
  4. git push โ€” share your branch.
  5. Open a Pull Request for review.
  6. Merge after approval.
Always pull before you push. If the remote has commits you don't, Git will reject your push until you integrate them.