DevOps & Development Experts
From CI/CD pipelines to custom applications, our team builds secure solutions that scale.
What Is Git Command Reference
Git is the most widely used distributed version control system, tracking changes to source code across software development projects. With over 150 commands and thousands of flags, Git's command-line interface is powerful but complex. Even experienced developers regularly look up less common commands, flag combinations, and workflows.
This tool provides a searchable reference for Git commands organized by workflow — from basic operations to advanced rebasing, bisecting, and repository maintenance.
Essential Git Commands by Workflow
Daily Development
| Command | Purpose | Example |
|---|---|---|
| git status | Show working tree status | git status -sb |
| git add | Stage changes | git add -p (interactive staging) |
| git commit | Record changes | git commit -m "Fix login timeout" |
| git pull | Fetch and merge remote changes | git pull --rebase origin main |
| git push | Upload local commits | git push origin feature-branch |
| git diff | Show unstaged changes | git diff --cached (staged changes) |
| git log | View commit history | git log --oneline --graph |
| git stash | Temporarily shelve changes | git stash push -m "WIP login fix" |
Branching and Merging
| Command | Purpose | Example |
|---|---|---|
| git branch | List, create, delete branches | git branch -d feature-branch |
| git checkout | Switch branches or restore files | git checkout -b new-feature |
| git switch | Switch branches (modern) | git switch -c new-feature |
| git merge | Combine branch histories | git merge --no-ff feature-branch |
| git rebase | Reapply commits on new base | git rebase main |
| git cherry-pick | Apply specific commits | git cherry-pick abc1234 |
Common Use Cases
- Command lookup: Quickly find the correct syntax and flags for Git operations you perform infrequently
- Workflow standardization: Generate consistent Git commands for team workflows (branching strategies, commit conventions, merge methods)
- Troubleshooting: Find commands for recovering from common Git mistakes (wrong branch, bad merge, lost commits)
- Learning Git: Explore Git commands with explanations of what each flag does and when to use different options
- Script generation: Generate Git commands for automation scripts, CI/CD pipelines, and deployment workflows
Best Practices
- Use conventional commits — Structure commit messages as type(scope): description (e.g., "fix(auth): resolve session timeout") for automated changelogs and SemVer bumping.
- Prefer rebase for feature branches — git pull --rebase keeps history linear. Merge commits from git pull create unnecessary noise in the log.
- Never force-push to shared branches — git push --force rewrites remote history and can destroy teammates' work. Use --force-with-lease if you must rewrite a shared branch.
- Use interactive staging — git add -p lets you stage individual hunks within files, creating focused commits that are easier to review and revert.
- Write meaningful commit messages — The first line should summarize the change in 50 characters. The body should explain why, not what (the diff shows what).
Frequently Asked Questions
Common questions about the Git Command Reference
The reference is organized by practical tasks and categories including Setup and Basics, Commits, Fix Mistakes, Branching and Merging, Collaboration, History and Inspection, Workspace and Stash, Recovery and Safety, and Scaling and Performance. Each command guide includes when to use it, pro tips, and common pitfalls to avoid.
ℹ️ Disclaimer
This tool is provided for informational and educational purposes only. All processing happens entirely in your browser - no data is sent to or stored on our servers. While we strive for accuracy, we make no warranties about the completeness or reliability of results. Use at your own discretion.