Preserve in-progress work and reset all p7 repos to latest master
Preserve any in-progress work across all p7 repositories, then reset everything to latest master. Fully autonomous — no user prompts.
NEVER push to remote. NEVER include Co-Authored-By or AI attribution in commits. No emojis in commit messages.
Enumerate all git repos under /home/midori/_dev/p7. Repos live in:
/home/midori/_dev/p7/*//home/midori/_dev/p7/_adapters/*//home/midori/_dev/p7/_libs/*//home/midori/_dev/p7/_infra/*//home/midori/_dev/p7/_backoffice/*/Skip non-repo directories (those without .git).
Process 10-15 repos per bash call for efficiency. For each repo, collect:
git rev-parse --abbrev-ref HEAD)git status --porcelain)| Category | Branch | Tree | Action |
|---|---|---|---|
| CLEAN_MASTER | master | clean | git pull |
| CLEAN_BRANCH | feature | clean | git checkout master && git pull |
| DIRTY_BRANCH | feature | dirty | commit, git checkout master && git pull |
| DIRTY_MASTER | master | dirty | create branch, commit, git checkout master && git pull |
Print a markdown table showing every repo, its current branch, category, and planned action. Example:
| Repo | Branch | Status | Action |
|------|--------|--------|--------|
| game-api | feat/coin-fraction | CLEAN_BRANCH | checkout master, pull |
| client-api | master | DIRTY_MASTER | branch + commit, checkout master, pull |
| common-errors | master | CLEAN_MASTER | pull |
Process each dirty repo individually (need to read diffs for meaningful commit messages).
git diff --stat and git diff (truncate if huge) to understand changesfeat, fix, refactor, chore, docs, test, etc.feat/add-retry-logic^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)\/[a-z0-9\-]{1,55}$git checkout -b <type>/<slug>git diff --stat and git diff to understand changesgit add -A to stage everythingtype(scope): descriptiongameapi, slotcatalog, commonerrors, clientapigit commit -m "$(cat <<'EOF'
type(scope): description
EOF
)"
Batch all repos (10-15 per bash call). For each repo:
cd /path/to/repo && git checkout master && git pull
Use ; (not &&) between repos so one failure doesn't block others. Handle pull failures gracefully — log them and continue.
For repos already on clean master, just git pull.
Print a final report:
## Reset Complete
- **Repos processed:** 78
- **Already clean on master:** 65
- **Branches preserved:** 8 (list them with repo name + branch)
- **Commits created:** 5 (list them with repo name + message)
- **Errors:** 0 (or list any failures)
All repos are now on master.
Include the list of preserved branches so the user knows where their work-in-progress lives.