CHAPTER 3 · 1 lesson · 13 exercises
Sharing with Remote Repositories
Push local commits to remote repositories (origin) and pull changes to synchronize.
0 / 13 solved
Everything so far has stayed on your local machine. In this chapter, you synchronize with a remote repository.
Keep one key rule in mind: a remote repository is not a special server; it is just another Git repository. It has the exact same structure as your local repository. It simply lives on the network.
git push… send your local commits to the remote repositorygit fetch… download latest commits from the remote (without moving local branches)git pull… download remote commits and immediately merge them into your branch
The most common hurdle here is a rejected git push.
When the remote has new commits you do not have locally, Git blocks your push. Overwriting would destroy someone else's work. You git pull first, merge their work, and then push again. After pulling, resolve any conflicts and check the result before pushing.
Lessons in this chapter
Push and Pull
- 03Sharing with remote repositoriesSynchronize history with remote repositories (origin) using push, fetch, and pull, and learn to resolve push rejections.Go to the exercises