Step 6 / 6 ยท Push

Push: share with the team

Push sends your commits to the remote. Now the team can get them.

Illustration: the gardener takes a cart of photos to the greenhouse, where a teammate greets them
In the garden

So far, everything has stayed at home. Now you take the cart of photos to the greenhouse, and your teammate can see the new garden.

In practice

git push sends your commits to the remote repository and updates the branch there. After that, the team can see the same history as you.

The way back: git fetch downloads the greenhouse's new history without changing your files; git pull downloads it and brings it into the branch you are on.

Commands

git push origin main  # send main to the greenhouse
git fetch  # only download the new history
git pull  # download and bring it in

Tip: Commit saves at home. Push shares with the team.

What the history looks like

AfirstBpathCfenceDflowers 1Eflowers 2Mmergemaingreenhouse (origin/main) after push