Skip to content
Gi

Git

Status inspection, branching strategies, commits, and collaboration.

12 commandsversion-controlworkflow

Command catalog

Repository statusGit

git status

Show tracked, staged, and untracked files at a glance.

git status -sb
Repository statusGit

git log

Inspect commit history with optional graphing.

git log --oneline --graph --decorate --all
Repository statusGit

git diff

Compare file changes between commits, branches, or workspace states.

git diff HEAD~1
Branching workflowGit

git checkout

git switch

Switch branches or restore files to a known state.

git switch <branch>
Branching workflowGit

git merge

Combine commits from a source branch into the current branch.

git merge <branch>
Branching workflowGit

git rebase

Replay commits onto a new base for linear history.

git rebase origin/main
Staging and commitsGit

git add

Stage files or hunks before committing.

git add <file>
Staging and commitsGit

git commit

Record staged changes with messages and metadata.

git commit -m "<message>"
Staging and commitsGit

git stash

Temporarily shelve uncommitted work.

git stash push -m "<label>"
Remote collaborationGit

git fetch

Download remote refs without merging them.

git fetch origin
Remote collaborationGit

git pull

Fetch and integrate remote changes.

git pull --rebase origin main
Remote collaborationGit

git push

Publish local commits to remotes.

git push origin <branch>