GitHub Workflow
Full GitHub lifecycle management through the gh CLI.
When to Use
- User mentions GitHub, repos, branches, commits, or pull requests
- User wants to manage issues, labels, or milestones
- User needs code review assistance
- User wants to set up CI/CD or manage releases
Procedure
Repository Operations
- Clone:
gh repo clone owner/repo - Create:
gh repo create name --public/--private - Fork:
gh repo fork owner/repo
Branch Workflow
- Create feature branch:
git checkout -b feature/name - Stage changes:
git add -A - Commit with conventional message:
git commit -m "type: description" - Push:
git push -u origin feature/name
Pull Request Workflow
- Create PR:
gh pr create --title "..." --body "..." --base main - List PRs:
gh pr list - Review PR:
gh pr review <number> --approve/--request-changes - Merge:
gh pr merge <number> --squash
Issue Management
- Create:
gh issue create --title "..." --body "..." --label bug - List:
gh issue list --state open - Close:
gh issue close <number> - Assign:
gh issue edit <number> --add-assignee @me
Release Workflow
- Tag:
git tag -a v1.0.0 -m "Release v1.0.0" - Push tags:
git push --tags - Create release:
gh release create v1.0.0 --generate-notes
Commit Message Convention
- feat: new feature
- fix: bug fix
- docs: documentation
- refactor: code restructuring
- test: adding tests
- chore: maintenance
Pitfalls
- Always check current branch before committing
- Pull before push to avoid conflicts
- Use --force-with-lease instead of --force
- Verify PR base branch is correct
Verification
- Confirm PR was created:
gh pr view <number> - Verify merge status:
gh pr status - Check CI status:
gh run list