git-and-pr-workflow
Skill0 starsChanged 4 months agoMITView on GitHub
Guides Git branching, atomic commits, rebasing, resolving merge conflicts, worktrees, pull request descriptions, and safely finishing a branch. Use when creating branches, staging and committing changes, rebasing or squashing, resolving conflicts, opening or updating a pull request, or cleaning up after merge.
- Deletes or force-pushes
- Commits and pushes
In this repository24 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agent-tool-interface-designSkill
- codebase-explorationSkill
- code-reviewSkill
- copilot-cloud-agentSkill
- documentation-maintenanceSkill
- external-skill-reviewSkill
- parallel-worktree-deliverySkill
- planning-and-task-breakdownSkill
- refactoring-and-dead-code-removalSkill
- repository-agent-bootstrapSkill
- requirements-and-spec-writingSkill
- security-reviewSkill
- shadow-architectureSkill
- shadow-dreamSkill
- shadow-driftSkill
- shadow-observeSkill
- skill-creatorSkill
- systematic-debuggingSkill
- test-driven-developmentSkill
- verification-before-completionSkill
- verification-disciplineSkill
- wayfinder-planningSkill
- web-research-and-verificationSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
18 rules. About 0 are common, 13 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈13
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 21
Never rewrite history that is already published or shared.
- Distinctive: line 23
Never force-push a shared branch.
- Distinctive: line 27
Keep one logical change per commit.
- Distinctive: line 28
Write commit subjects in the imperative mood: "Add", "Fix", "Rename".
- Distinctive: line 34
Update the base branch: git switch main then git pull --ff-only.
- Very specific: line 35
Create a topic branch: git switch -c <type>/<short-description>.
- Distinctive: line 46
Commit with a clear subject and, when the change needs justification, a body.
- Very specific: line 53
Prefer rebase over merge to integrate the latest base into an in-progress, unshared branch: git fetch then git rebase origin/main.
- Distinctive: line 55
If the branch is already shared and others may have based work on it, merge the base in instead of rebasing, to avoid rewriting shared …
- Very specific: line 61
After a rebase, push your own branch with git push --force-with-lease, never plain --force.
- Distinctive: line 66
Read git status to list conflicted files.
- Distinctive: line 69
Remove all conflict markers, then stage the resolved file by explicit path.
- Distinctive: line 70
Run the repository's test command to confirm the resolution is correct.
- Distinctive: line 81
Write the description so a reviewer needs no other context:
- Distinctive: line 86
Keep the pull request focused on one logical change.
- Very specific: line 92
Verify no unpushed commits remain: git log origin/<branch>..HEAD returns nothing.
- Distinctive: line 93
Delete the local branch (git branch -d, which refuses unmerged work) and the remote branch when the platform did not remove it.
- Very specific: line 95
Remove any worktree created for the branch: git worktree remove <path>.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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
Git and PR Workflow
Produce clean, reviewable history and a clear pull request without corrupting shared branches or losing work. This workflow is intentionally low-freedom: history and remote state are hard to recover, so follow the safety rules exactly.
Safety Rules
- Stage explicit paths (
git add path/to/file). Never usegit add -Aorgit add ., which capture unrelated edits, scratch files, and secrets. - Never rewrite history that is already published or shared. Rebase, amend, and squash only commits that live solely on your local branch.
- Never force-push a shared branch. If a rewrite of your own branch is required,
use
git push --force-with-lease, which refuses to overwrite unseen remote work. - Review the full diff before every commit. Read
git diff --stagedin full, not just the file list. - Keep one logical change per commit. Unrelated changes belong in separate commits.
- Write commit subjects in the imperative mood: "Add", "Fix", "Rename".
Start Work
- Confirm a clean starting point with
git status. Stash or commit unrelated local changes before branching. - Update the base branch:
git switch mainthengit pull --ff-only. - Create a topic branch:
git switch -c <type>/<short-description>. Use a descriptive slug such asfix/login-null-check. - Confirm the new branch and base with
git statusbefore editing.
Commit Changes
- Review every change with
git statusandgit diff. - Group related edits. Stage each group by explicit path.
- Re-read the staged diff with
git diff --staged. Unstage anything unrelated. - Scan the staged diff for secrets, credentials, tokens, and debug output before committing.
- Commit with a clear subject and, when the change needs justification, a body. See commit message rules.
- Split accidental mixed changes: unstage, then re-stage one logical group at a time so each commit stands alone.
Keep History Current
- Prefer rebase over merge to integrate the latest base into an in-progress,
unshared branch:
git fetchthengit rebase origin/main. - If the branch is already shared and others may have based work on it, merge the base in instead of rebasing, to avoid rewriting shared commits.
- To tidy local-only commits before review, use
git rebase -ito reorder, squash, or reword. Never do this to commits others already pulled. - Resolve any conflicts that arise, then continue. See worktrees and conflicts.
- After a rebase, push your own branch with
git push --force-with-lease, never plain--force.
Resolve Conflicts
- Read
git statusto list conflicted files. - Open each file and reconcile the intent of both sides. Do not blindly keep one side or delete the markers without understanding the change.
- Remove all conflict markers, then stage the resolved file by explicit path.
- Run the repository's test command to confirm the resolution is correct.
- Continue the operation with
git rebase --continueorgit merge --continue. Abort with--abortif the resolution is unclear and a fresh attempt is safer. See worktrees and conflicts for worktree-based isolation.
Open a Pull Request
- Push the branch:
git push -u origin <branch>. - Confirm the diff against the base is exactly the intended change; remove stray commits first.
- Write the description so a reviewer needs no other context:
- What changed and why, in the first sentences.
- The problem or issue it addresses, with a link when one exists.
- How it was verified, naming the commands run.
- Risks, follow-ups, and anything intentionally out of scope.
- Keep the pull request focused on one logical change. Split unrelated work into separate pull requests.
Finish a Branch
- Confirm the change is merged into the base and the base is updated locally.
- Verify no unpushed commits remain:
git log origin/<branch>..HEADreturns nothing. - Delete the local branch (
git branch -d, which refuses unmerged work) and the remote branch when the platform did not remove it. - Remove any worktree created for the branch:
git worktree remove <path>. - Return to an updated base branch and confirm a clean
git status.
Report
State the branch, the commits made, verification commands run and their result, the pull request opened or updated, and any cleanup still pending.
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.

