automating-git-workflows
Skill0 starsChanged 4 months agoMITView on GitHub
Automates the commit-push-PR loop with a branch-protection guard, and diagnoses failing CI checks from actual log output. Use whenever the user wants to commit and push changes, open a pull request, or debug why a GitHub Actions check is failing.
- Deletes or force-pushes
- Commits and pushes
In this repository19 other files it gives its agents.
- adding-authenticationSkill
- auditing-seoSkill
- building-email-sequencesSkill
- building-graphql-apisSkill
- building-wordpress-pluginsSkill
- designing-carouselsSkill
- fine-tuning-ml-modelsSkill
- handling-web-formsSkill
- n8n-automationSkill
- organizing-spreadsheetsSkill
- reviewing-cloudflare-workers-codeSkill
- reviewing-code-for-securitySkill
- scaffolding-landing-pagesSkill
- setting-up-error-monitoringSkill
- setting-up-firebase-authSkill
- using-nextjs-best-practicesSkill
- working-with-postgres-databasesSkill
- writing-marketing-copySkill
- writing-terraform-codeSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Review the diff before staging anything: - run git status and git diff, summarize what changed, and confirm it matches intent.
- Very specific: line 27
If origin isn't configured or push fails: the script reports the git error directly rather than silently swallowing it - confirmed in …
- Very specific: line 28
If gh isn't installed: pushes successfully and tells the user to open the PR manually, instead of failing the whole operation.
- Distinctive: line 32
If a CI failure looks environment-related (passes locally, fails in CI only), say so explicitly rather than making speculative code changes …
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Automating git workflows
Runs the commit → push → PR loop safely (with a guard against committing straight to main/master), and diagnoses CI failures from real log content instead of guessing.
Workflow
- Review the diff before staging anything - run
git statusandgit diff, summarize what changed, and confirm it matches intent. Don't commit unrelated changes that happened to be in the working directory. - Run
scripts/commit-and-pr.sh(tested below) to stage, commit, push, and open the PR in one step. It refuses to run onmain/master- the user needs to be on a feature branch first. - Write the commit message to explain why, not just what - pass it as the second argument (commit body), separate from the one-line subject.
- For a failing CI check: pull the actual failure log (
gh run view <run-id> --log-failedor the Actions UI), not just the pass/fail badge. Identify whether it's the code change itself, a flaky test, or an environment/dependency mismatch before proposing a fix. - Never force-push to a shared branch without explicit confirmation from the user - this script never force-pushes, and any fix involving
git push --forceneeds to be flagged and confirmed separately.
Using the script
scripts/commit-and-pr.sh "commit subject" "commit body" "PR title" "PR body"Tested behavior (verified in a real throwaway repo, not just read):
- On
main/master: exits immediately with a clear message, makes no changes. Confirmed: exit code 1, no commit created. - On a feature branch with changes staged: commits with subject + body, then pushes. Confirmed: commit created correctly (
git logshows it). - If
originisn't configured or push fails: the script reports the git error directly rather than silently swallowing it - confirmed in testing (clean fatal error surfaced, script didn't crash uninformatively). - If
ghisn't installed: pushes successfully and tells the user to open the PR manually, instead of failing the whole operation.
Notes
- If a CI failure looks environment-related (passes locally, fails in CI only), say so explicitly rather than making speculative code changes to "fix" what might be a flaky pipeline or a CI-only env var.
- The script uses
set -euo pipefail- any unexpected failure stops execution instead of continuing in a broken state.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

