Code & computing / QUICK REFERENCE
Everyday Git
A practical reference for inspecting changes, making commits, navigating history and working with branches.
Inspect before you change
- Working tree overview
git statusShows staged, unstaged and untracked paths. [2]
- Compact status
git status --shortGives a concise path-by-path summary. [2]
- Unstaged changes
git diffCompares tracked working files with the index. [3]
- Staged changes
git diff --cachedShows exactly what the next commit would include. [3]
- Change summary
git diff --statSummarizes tracked changes by file. [3]
- Check whitespace errors
git diff --checkReports whitespace errors in the proposed diff. [3]
- List tracked files
git ls-filesUntracked paths do not appear here. [4]
- Current commit identity
git rev-parse HEADPrints the full current commit hash. [5]
Save intentional snapshots
- Create a repository
git initInitializes Git in the current directory. [6]
- Stage one file
git add notes.txtStages the file's current contents. [7]
- Stage selected hunks
git add -pInteractively chooses pieces to stage. [7]
- Commit staged changes
git commit -m "Describe the change"Commits the index, not every working-tree edit. [8]
- Show configured identity
git var GIT_AUTHOR_IDENTDisplays the identity Git will use. [9]
- Repository root
git rev-parse --show-toplevelLocates the working tree's top directory. [5]
- Clone a repository
git clone https://github.com/OWNER/REPO.gitDownloads a repository into a new directory. [10]
- Ignore-file location
.gitignoreStore ignore patterns here; already tracked files remain tracked. [11]
Branches and cautious synchronization
- List local branches
git branchMarks the active branch with an asterisk. [12]
- Show branch tracking
git branch -vvIncludes upstream relationships when configured. [12]
- Create and switch
git switch -c feature-notesStarts a branch from the current commit. [13]
- Switch to an existing branch
git switch mainMay refuse if local changes would be overwritten. [13]
- Return to previous branch
git switch -Returns to the previous checkout target. [13]
- List remote addresses
git remote -vVerify destinations before fetching or pushing. [14]
- Fetch remote updates
git fetch originUpdates remote-tracking refs without merging into your branch. [15]
- Fast-forward only merge
git merge --ff-only origin/mainRefuses a merge that would need a merge commit. [16]
Read the history
- Recent commits
git log --oneline -5Shows five compact commit summaries. [17]
- Branch graph
git log --graph --oneline --decorate --allDisplays the relationship between reachable commits. [17]
- Show one commit
git show HEADDisplays the current commit and its patch. [18]
- History for a file
git log -- notes.txtRestricts history to that path. [17]
- Follow a renamed file
git log --follow -- notes.txtFollows one file through detectable renames. [17]
- Find commit messages
git log --grep="fix"Searches commit messages, not source contents. [17]
- Who last changed each line
git blame -- notes.txtAttributes lines to commits; it is not proof of authorship quality. [19]
- Recent reference movements
git reflog -10Helps inspect local moves; it is not a remote backup. [20]
Reserved placement, separate from reference controls. No ad network is active.
No matching entry. Try a shorter word or clear the search to see the complete sheet.
Sources
- Git tutorial ↗
- Git status reference ↗
- Git diff reference ↗
- Git ls-files reference ↗
- Git rev-parse reference ↗
- Git init reference ↗
- Git add reference ↗
- Git commit reference ↗
- Git var reference ↗
- Git clone reference ↗
- Git gitignore reference ↗
- Git branch reference ↗
- Git switch reference ↗
- Git remote reference ↗
- Git fetch reference ↗
- Git merge reference ↗
- Git log reference ↗
- Git show reference ↗
- Git blame reference ↗
- Git reflog reference ↗
cheatsheetatlas.com/sheets/git-everyday/ · Updated 2026-10-19 · Git CLI · local and remote workflows