| name | git |
| description | Git commands, workflows, and troubleshooting |
| argument-hint | [command or question] |
| allowed-tools | Bash, Read |
Help with Git based on $ARGUMENTS.
Common Commands
Basics
git status
git add <file>
git add -p
git commit -m "message"
git push
git pull
Branching
git branch
git branch <name>
git checkout <branch>
git checkout -b <name>
git merge <branch>
git rebase <branch>
git branch -d <name>
git branch -D <name>
History
git log --oneline
git log --graph
git log -p <file>
git blame <file>
git show <commit>
Undoing
git checkout -- <file>
git reset HEAD <file>
git reset --soft HEAD~1
git reset --hard HEAD~1
git revert <commit>
Stashing
git stash
git stash pop
git stash list
git stash drop
Remote
git remote -v
git remote add <name> <url>
git fetch <remote>
git push -u origin <branch>
Workflows
Feature Branch
git checkout -b feature/name
- Make changes, commit
git push -u origin feature/name
- Create PR
- Merge and delete branch
Rebase Workflow
git fetch origin
git rebase origin/main
- Resolve conflicts if any
git push --force-with-lease