Git 100 · lesson 2

Basic Workflow

Where your changes live, and the commands that move them: add, commit, push, fetch, merge and pull.

Four places a change can be

LOCAL · your computer REMOTE Workingdirectory Stagingarea Localrepository Remoterepository add commit push fetch merge pull = fetch + merge hello.py john #1 john #2

The workflow at a glance

Git workflow: add moves changes from the working directory to the staging area, commit to the local repository, push to the remote; fetch brings remote commits to the local repository, merge into the working directory, and pull does both
Source: CloudStudio.com.au

The six commands

git addWorking directory → staging area: choose what goes into the next commit
git commitStaging area → local repository: save a snapshot with a message
git pushLocal repository → remote: share your commits
git fetchRemote → local repository: download others' commits without touching your files
git mergeLocal repository → working directory: combine those commits with your work
git pullFetch and merge in one command