iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
These five Git commands cover the core loop of checking changes, selecting what belongs in a commit, recording it, integrating upstream work, and sharing your commits. Together they make a useful everyday workflow: git status → git add → git commit → git pull or git push.
How the five commands fit together
Git work moves through three local states: the working tree contains your current files, the index (or staging area) holds the content selected for the next commit, and HEAD identifies the current committed history. git status helps you see differences between those states. git add selects content for the index, and git commit records the staged snapshot. Pull and push exchange work with an upstream repository: pull brings upstream work into the current branch, while push shares local commits.
| # | Preview | Product | Price | |
|---|---|---|---|---|
| 1 |
|
Git Commands Cheat Sheet Reference Guide – Essential Git Command Quick Guide for Beginners... | $14.99 | Buy on Amazon |
| 2 |
|
Git Pocket Guide: A Working Introduction | $13.99 | Buy on Amazon |
| 3 |
|
GIT Beginners Command Reference Pocket Guide | $0.99 | Buy on Amazon |
| 4 |
|
Linux Pocket Guide: Essential Commands | $19.75 | Buy on Amazon |
| 5 |
|
Ry's Git Tutorial | $0.99 | Buy on Amazon |
The examples below assume you are inside a Git repository. Remotes, branch settings, and team policies vary, so follow the workflow configured for your project.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →1. Check the repository with git status
Run git status after editing and before committing. It reports paths that differ between the working tree and index, paths staged relative to the current HEAD, and untracked files that Git is not ignoring. That gives you a checkpoint before you decide what to stage.
#1 Best Overall
git status
Human-readable output is enough for routine checks. Ignored files ordinarily do not appear as untracked files. Output can vary with Git version and configuration; for scripts, the manual documents short output and a stable porcelain format. Some submodule states require additional care. Check your installed version with git --version.
2. Choose what enters the next snapshot with git add
git add copies the specified file contents, as they exist when the command runs, into the index. For example, stage one file with:
Rank #2
git add src/example.js
To stage only selected changes within a file, use interactive patch mode:
git add -p src/example.js
Because staging captures the file at that moment, edits made afterward are not automatically included in the staged version. Run git add again for the later edits you want in the commit. Ignored files are not added by default. Staging deliberately helps keep unrelated work out of a snapshot.
3. Record the staged snapshot with git commit
A regular git commit records staged changes; it does not automatically include every unstaged edit visible in the working tree. Review the staged content and repository state before recording it:
git status
git diff --cached
git commit -m "Describe the change"
The commit message should make the change understandable later. The Git user manual suggests a short first line, with more detail afterward when useful; this is a convention, not a strict requirement.
Rank #4
The -a option to git commit stages modifications and removals of already tracked files as part of the commit. It does not include new untracked files, so check status rather than assuming it captures everything.
4. Integrate upstream work with git pull
git pull obtains upstream changes and integrates them into the current work. It is not simply a command that makes every local file match the remote: branches can diverge, and integration can produce conflicts that need attention.
Best Value
git status
git pull
Before pulling, check the repository state and follow the project’s expected workflow. If Git reports conflicts or requests a decision about integration, read the output and resolve the situation according to your team’s process. The integration strategy and defaults depend on Git version and configuration; there is no single setting to prescribe for every repository.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.5. Share local commits with git push
After creating commits, git push is the command used to share local work with a remote repository. Git groups it among the commands for sharing and updating projects.
git push
Whether that exact invocation is sufficient depends on the repository’s remote and branch configuration. Use the command and setup specified by your project; the command name alone does not establish how authentication, branch protections, or rejected updates are handled.
Recommended Free Tools
The everyday sequence
git statusto inspect staged, unstaged, and untracked work.git add <file>orgit add -pto select what belongs in the next snapshot.git statusand, when useful,git diff --cachedto review the selection.git committo record the staged changes.git pullto integrate upstream work when appropriate, orgit pushto share local commits.
For command-specific details, see the Git Project manuals for git status, git add, git commit, and git pull, along with its command reference and user manual.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

