Um momento
0x40Lesson 5 of 6

Share work with remotes

Clone repositories and understand fetch, pull and push.

12 min 5-question quiz
By the end of this lesson you can
  • Use remote commands to synchronize without confusing local and hosted history.

A remote is a named URL for another copy of a repository, often hosted on a service. git fetch downloads commits and updates remote-tracking references without changing your current branch. git pull fetches and then integrates; git push sends your local commits to a remote.

terminal · git
1git clone https://example.com/team/app.git
2cd app
3git remote -v
4
5git fetch origin
6git log --oneline main..origin/main
7
8git push -u origin feature/profile
Output
origin  https://example.com/team/app.git (fetch)
origin  https://example.com/team/app.git (push)

# commits on origin/main not yet in main

branch 'feature/profile' set up to track 'origin/feature/profile'

An upstream branch links a local branch to its remote counterpart so commands such as git pull and git push can infer a destination. Always inspect what you are pushing, especially if the remote branch has moved.

Key takeaways

  • git clone creates a local copy of a remote repository.

  • git fetch downloads updates; git pull also integrates them.

  • git push sends commits to a remote, and -u sets an upstream on first push.

Lesson quiz

5 questions · pass with 4 correct · up to 50 XP

Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.

Questions about this lesson

Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.

Loading posts…

Gostou da aula? 😆👍
Apoie nosso trabalho com uma doação: