git-push
Push commits จาก local repository และ git submodules ไปยัง remote repository อย่างปลอดภัย
SKILL.mdgit-push/SKILL.md
GitHubGoal
Safely push commits from the local repository and git submodules to the remote repository
Scope
Use to push commits to the remote repository for both the root repo and git submodules
Execute
1. Check Status And Commits
Goal: Check Status And Commits
- run
git branch --show-current,git status, andgit submodule statusto see the current state - run
git log --oneline origin/<branch>..HEADto see the commits to push - run
/scan-codebaseon the scope to be pushed to snapshot the structure/patterns/quality of what changed - if the diff touches manifest/lockfile or auth/payment/secrets code → also run
/scan-securityand resolve Critical/High before pushing - always consider
/refactor-commitbefore push — check that commits are appropriately sized, with clear messages and logical order — if commits are too large or messages unclear, run/refactor-commitbefore pushing
2. Push
Goal: Push
- run
git push origin <branch>andgit submodule foreach --recursive git push origin <branch>— never use--no-verifyor flags that skip any kind of git hook - if a git hook reports an error, fix the root cause instead of skipping the hook — run
/resolve-errorsif needed - if the push is rejected, stop and inform the user; do not force push
3. Validate
Goal: Validate
- run
git log --oneline origin/<branch> -5to confirm the commits appear on the remote - run
git statusto confirm local and remote are in sync
4. Check GitHub Actions
Goal: Check GitHub Actions
- run
gh workflow listto check whether the repo has GitHub Actions - if yes, run
/resolve-github-actions-failsto check and re-run until they pass
5. Update GitHub Repo Metadata
Goal: Update GitHub Repo Metadata
Update repository metadata to reflect the real project — use /update-github-metadata as the canonical workflow
- run
/update-github-metadatato update description, homepage, topics, default branch - check that
package.jsonhas therepository,homepage,bugs,licensefields complete - for a public repo, set
--enable-issues=trueand--enable-wiki=false(use docs instead)
6. Open Repo
Goal: Open Repo
- run
git remote get-url originto see the remote URL - convert the SSH URL to an HTTPS URL, then run
/open-webto open the repo in the browser
7. Ensure Repository Ready (Optional)
Goal: Ensure Repository Ready (Optional)
Do this only when git reports an error that there is no repository or no remote
- if there is no
.git, rungit init,git add -A,git commit -m "Initial commit", and run/update-gitignore - if there is no remote, run
gh repo create <repo-name> --private --source=. --remote=origin --pushusing the folder name as the repo name
Rules
1. Repository Initialization
- this is an optional step, done only when
gitreports an error - if there is no remote, create one with
gh repo createas--privateinitially - use the current folder name as the repo name automatically
- run
/update-gitignoreaftergit initto ensure.gitignoreis complete
2. Safety
- never use
--no-verifyor any other flag that skips git hooks (e.g.--no-verify,HOOK_SKIP=true) — git hooks must always run - always pass the scan gate (
/scan-codebase+/scan-securitywhen applicable) before pushing — never push with unresolved Critical/High - if a git hook reports an error, fix the root cause instead of skipping the hook — run
/resolve-errorsif needed - always consider
/refactor-commitbefore push to keep commits clean and appropriate - do not force push unless truly necessary
- if the push is rejected, stop and inform the user; do not force push
3. Submodules
- always push both the root repo and the submodules
- use
git submodule foreach --recursivefor all operations
4. GitHub Repo Metadata
use
/update-github-metadataas the canonical workflow for metadataset the metadata every time after creating a new repo or the first push
check that
package.jsonhasrepository,homepage,bugs,licensecompletefor a public repo, set
--enable-issues=trueand--enable-wiki=falseUse /git-commit if needed
Use /git-commit-and-push if needed
Expected Outcome
- the repository is ready to push even without an existing
.gitor remote - the push scope passes the scan gate (
/scan-codebase,/scan-securitywhen applicable) before pushing - commits pushed to the remote successfully (both root and submodules)
- local and remote are in sync
- all GitHub Actions pass
- the repo opens in the browser automatically after a successful push
- show a clickable URL of the commit on the remote