Archived
docs: add git skill for agents
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6ca12e6d99
commit
4bb97b80b0
2 files changed
+76
No files matched your search
@@ -0,0 +1,75 @@
|
||||
---
|
||||
name: git
|
||||
description: How to do git in the barn repo — branches, commits, pushing, pull requests and the Gitea remote. Use whenever committing, branching, pushing, rebasing or opening a PR here.
|
||||
---
|
||||
|
||||
# Git in `barn`
|
||||
|
||||
Remote: `https://gitea.samson.media/samson-media/barn.git` (Gitea, not GitHub). Default branch: `main`.
|
||||
|
||||
## Ground rules
|
||||
|
||||
- Pull requests go through **`tea`** (already logged in as `gitea.samson.media`), not `gh` — `gh` can't resolve these repos. Some older docs still show `gh pr create`; translate it:
|
||||
`tea pulls create --base main --head <branch> --title "..." --description "..."`
|
||||
- PRs are merged in Gitea with **"Create merge commit"**, which produces `Merge pull request '<title>' (#N) from <branch> into <base>`. Don't squash or rebase-merge unless the user asks.
|
||||
- Only commit, push or open a PR when the user asked for it. Approval for one push doesn't cover the next.
|
||||
- Stage specific paths (`git add path/to/file`), never `git add -A` / `git add .` — untracked local dirs such as `.ignore/` (secret mirrors) must never be committed.
|
||||
- Never commit secrets, `.env` files or credentials.
|
||||
- Never `git push --force`, `git reset --hard`, `git clean -f` or delete remote branches without the user typing **CONFIRM DESTRUCTIVE ACTION**. If a push is rejected, fetch and rebase; don't force.
|
||||
- Never `--no-verify` to get past a hook. Fix the cause.
|
||||
- End commit messages with the attribution trailer your harness specifies (e.g. `Co-Authored-By: ...`).
|
||||
|
||||
## Everyday flow
|
||||
|
||||
```bash
|
||||
git status -sb # check branch and ahead/behind first
|
||||
git fetch origin
|
||||
git rebase origin/main # or the branch you're on; rebase unpushed work, don't merge it
|
||||
git add <paths>
|
||||
git commit -m "<message>"
|
||||
git push origin <branch> # use -u the first time for a new branch
|
||||
```
|
||||
|
||||
Diverged from the remote (ahead N, behind M)? `git fetch` then `git rebase origin/<branch>`. Rebasing is fine for commits that are not pushed yet; for pushed commits ask first.
|
||||
|
||||
## Branches
|
||||
|
||||
Default branch `main`. Work on a branch (`feat/...`, `fix/...`, `chore/...`, `docs/...`), PR into `main`, merge with a merge commit. Releases are cut with a `Release vX.Y.Z` commit (see `release.yml`) — never tag or bump versions unless asked.
|
||||
|
||||
```bash
|
||||
git checkout main && git pull origin main
|
||||
git checkout -b feat/retry-columns
|
||||
# ...work...
|
||||
mvn verify # must pass before every commit
|
||||
git add <paths>
|
||||
git commit -m "feat(cli): add retry columns to barn status output"
|
||||
git push -u origin feat/retry-columns
|
||||
tea pulls create --base main --head feat/retry-columns --title "feat(cli): ..." --description "..."
|
||||
```
|
||||
|
||||
## Commit messages — Conventional Commits
|
||||
|
||||
`type(scope): description`, lower-case, imperative. Types: `feat`, `fix`, `docs`, `test`, `refactor`, `chore`, `ci`; breaking changes get `!`. Examples from history:
|
||||
|
||||
```
|
||||
feat(cli): add retry columns to barn status output
|
||||
fix(config): add load section to config show and fix env var override
|
||||
fix(ci): replace HOMEBREW_TAP_TOKEN PAT with GitHub App token
|
||||
chore: bump version to 0.2.0
|
||||
```
|
||||
|
||||
If there is a tracking issue, mention it in the body (`Refs #N`).
|
||||
|
||||
## Pre-commit hook
|
||||
|
||||
`.githooks/pre-commit` runs quality checks on staged `.java` files. Enable it once per clone:
|
||||
|
||||
```bash
|
||||
git config core.hooksPath .githooks
|
||||
```
|
||||
|
||||
If it fails, fix the problem and commit again — don't `--no-verify`. See the Commit Checklist in `AGENTS.md`.
|
||||
|
||||
## After pushing
|
||||
|
||||
Update this repo's pointer in the parent `development` repo (see the root git skill).
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../.agents/skills
|
||||
Reference in new issue
Block a user