Quick Reference
/commit /commit --push # Commit and push changes /commit --main # Commit directly to the default branch without creating a new branch /commit -m -p # Commit directly to the default branch and push
Workflow
Run these commands in parallel to gather information:
- •
git status - •
git diff - •
git log --oneline -5 - •
gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name'(to get default branch)
If --main or -m option is given, commit directly to the default branch without creating a new branch.
Otherwise, if the current branch is the default branch and there are differences, create a new branch. Give the branch an appropriate name and commit the changes.
If --push or -p option is given, push the branch to the remote repository.
Commit Message
Use the Conventional Commits format for commit messages:
<type>(<scope>)!: <subject> (blank line) <body> (blank line) <footer / BREAKING CHANGE / related issue(s) etc.>
Required: type, subject Optional: scope, ! (breaking change), body, footer
type list
feat : New feature fix : Bug fix docs : Documentation only style : Formatting (whitespace, semicolons, etc.) refactor : Refactoring (not a feature, not a bug fix) perf : Performance improvement test : Add/modify tests build : Build system / dependencies / distribution ci : CI configuration / scripts chore : Chore (other than src / test) revert : Revert previous commit