Skip to content

Commit 408eecf

Browse files
committed
clarify staging changes across branches
1 parent b381144 commit 408eecf

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

skills/gh-stack/SKILL.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,24 @@ Prefer initializing stacks with a prefix (`-p`). Prefixes group branches under a
7979

8080
### Staging changes deliberately
8181

82-
Don't dump all changes into a single commit or branch. Stage changes in batches based on logical grouping:
82+
The main reason to use `git add` and `git commit` directly is to control **which changes go into which branch**. When you have multiple files in your working tree, you can stage a subset for the current branch, commit them, then create a new branch and stage the rest there:
8383

8484
```bash
85-
# Stage only the model files for this branch
85+
# You're on feat/data-models with several new files in your working tree.
86+
# Stage only the model files for this branch:
8687
git add internal/models/user.go internal/models/session.go
8788
git commit -m "Add user and session models"
8889

89-
# Stage related migration
9090
git add db/migrations/001_create_users.sql
9191
git commit -m "Add user table migration"
92+
93+
# Now create a new branch for the API layer and stage the API files there:
94+
gh stack add api-routes # created & switched to feat/api-routes branch
95+
git add internal/api/routes.go internal/api/handlers.go
96+
git commit -m "Add user API routes"
9297
```
9398

94-
Multiple commits per branch are fine and encouraged—they make the PR easier to review. The key is that all commits in a branch relate to the same logical concern.
99+
This keeps each branch focused on one concern. Multiple commits per branch are fine — the key is that all commits in a branch relate to the same logical concern, and changes that belong to a different concern go in a different branch.
95100

96101
### When to create a new branch
97102

0 commit comments

Comments
 (0)