3.2 push, pull, and fetch
Remote collaboration depends on one key idea: your local repository and the remote repository are not live-synced. You explicitly send and receive commits.
push: send local commits out
bash
git pushgit push sends commits that already exist locally to the remote repository. It does not create commits for you, so you usually commit before pushing.
Loading concept check...
fetch: download remote information only
bash
git fetchfetch downloads new commit information from remote branches, but does not directly change your current working branch. It is useful when you want to inspect what happened remotely first.
pull: download and integrate
bash
git pullYou can roughly understand pull as fetch plus an integration step. The integration may be merge, or rebase depending on configuration.
Loading interactive lab...
Note
If you are new to team collaboration, build two habits: run
git pull before starting work, and check git status plus git log --oneline before pushing.Loading practice...