Home/Tools/Developer/Git Command Reference

Git Command Reference

Comprehensive Git command reference with examples. Learn git init, commit, branch, merge, rebase, stash, and advanced workflows.

100% Private - Runs Entirely in Your Browser
No data is sent to any server. All processing happens locally on your device.
Loading Git Command Reference...
Loading interactive tool...

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

CommandPurposeExample
git statusShow working tree statusgit status -sb
git addStage changesgit add -p (interactive staging)
git commitRecord changesgit commit -m "Fix login timeout"
git pullFetch and merge remote changesgit pull --rebase origin main
git pushUpload local commitsgit push origin feature-branch
git diffShow unstaged changesgit diff --cached (staged changes)
git logView commit historygit log --oneline --graph
git stashTemporarily shelve changesgit stash push -m "WIP login fix"

Branching and Merging

CommandPurposeExample
git branchList, create, delete branchesgit branch -d feature-branch
git checkoutSwitch branches or restore filesgit checkout -b new-feature
git switchSwitch branches (modern)git switch -c new-feature
git mergeCombine branch historiesgit merge --no-ff feature-branch
git rebaseReapply commits on new basegit rebase main
git cherry-pickApply specific commitsgit 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

  1. Use conventional commits — Structure commit messages as type(scope): description (e.g., "fix(auth): resolve session timeout") for automated changelogs and SemVer bumping.
  2. Prefer rebase for feature branches — git pull --rebase keeps history linear. Merge commits from git pull create unnecessary noise in the log.
  3. 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.
  4. Use interactive staging — git add -p lets you stage individual hunks within files, creating focused commits that are easier to review and revert.
  5. 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.