| name | git |
| description | Git version control operations via shell. Triggers: git, commit, branch, merge, diff, log, clone, push, pull, rebase, stash. |
Git Version Control
You can perform git operations using the shell tool. Use git for version control tasks like committing, branching, diffing, and managing repositories.
Common Operations
Status and History
git status
git log --oneline -20
git diff
git diff --staged
git show HEAD
Branching
git branch
git branch feature-name
git checkout feature-name
git checkout -b feature-name
git merge feature-name
Committing
git add <files>
git commit -m "message"
git commit --amend
Remote Operations
git pull origin main
git push origin branch-name
git fetch origin
git remote -v
Stash
git stash
git stash list
git stash pop
Investigation
git log --oneline --graph --all -20
git blame <file>
git log --follow -p -- <file>
git reflog
Best Practices
- Always check
git status before committing to see what will be included.
- Write clear, concise commit messages describing the "why" not the "what".
- Use
git diff to review changes before staging.
- Prefer creating new commits over amending published commits.
- Never force-push to shared branches without explicit permission.
- Stage specific files rather than
git add . to avoid committing unintended files.