You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(skills): document mergify stack note in mergify-stack skill (#1310)
The `mergify stack note` command exists but the mergify-stack skill
didn't mention it, so Claude never used it when amending pushed
commits. Add it to the conventions, commands reference, and common
mistakes table, plus a dedicated "Amend Notes" section explaining
how notes propagate to the PR's Revision history comment (markdown
table + JSON marker) via `mergify stack push`.
Also extend the description trigger list with "note" and
"revision history" so the skill activates on those keywords.
Copy file name to clipboardExpand all lines: skills/mergify-stack/SKILL.md
+32-1Lines changed: 32 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
name: mergify-stack
3
-
description: Use Mergify stacks for git push, commit, branch, and PR creation. ALWAYS use this skill when pushing code, creating commits, creating branches, or creating PRs. Triggers on push, commit, branch, PR, pull request, stack, stacked, git, rebase, checkout, reorder, move, sync, amend.
3
+
description: Use Mergify stacks for git push, commit, branch, and PR creation. ALWAYS use this skill when pushing code, creating commits, creating branches, or creating PRs. Triggers on push, commit, branch, PR, pull request, stack, stacked, git, rebase, checkout, reorder, move, sync, amend, note, revision history.
4
4
---
5
5
6
6
# Mergify Stack Workflow
@@ -20,6 +20,7 @@ A branch is a stack. Keep stacks short and focused:
20
20
21
21
-**Push**: Use `mergify stack push` (never `git push`)
22
22
-**Fixes**: Use `git commit --amend` (never create new commits to fix issues)
23
+
-**Amend notes**: When amending a commit that already has a PR (i.e. has been pushed), attach a `mergify stack note` BEFORE `mergify stack push` to record *why* the commit was amended. The note appears in the PR's "Revision history" comment and JSON marker, so reviewers can see the reason without diffing.
23
24
-**Mid-stack fixes**: Stash any local changes first (`git stash -u`), then use `git rebase -i` to edit the specific commit, amend it, continue rebase, then `mergify stack push`, then `git stash pop`
24
25
-**Reordering**: Stash any local changes first (`git stash -u`), then use `mergify stack reorder` (list all commits in desired order) or `mergify stack move` (move a single commit) instead of manual `git rebase -i` — non-interactive and avoids `GIT_SEQUENCE_EDITOR` quoting issues
25
26
-**Fixup**: Stash any local changes first (`git stash -u`), then use `mergify stack fixup <SHA>...` to fold a commit into its parent (drops the listed commit's message). Non-interactive — never use `git rebase -i` for this.
@@ -44,6 +45,7 @@ A branch is a stack. Keep stacks short and focused:
44
45
|`git rebase -i` to squash commits |`mergify stack squash A B into X [-m "..."]`| Non-interactive — works inside LLM/agent sessions; no editor spawned |
45
46
| Deferring lint fixes to a later commit | Include the fix in the commit that caused it | Each commit runs CI independently; later commits won't save earlier ones |
46
47
| Rebase/reorder/checkout/sync with dirty worktree |`git stash -u` first, then `git stash pop` after | Uncommitted changes are lost or cause conflicts during these operations |
48
+
| Amending a pushed commit with no explanation |`mergify stack note -m "why"` before `mergify stack push`| The reason is recorded in the PR's Revision history table and JSON marker, so reviewers don't need to diff to understand the change |
47
49
48
50
## Commands
49
51
@@ -63,6 +65,10 @@ mergify stack fixup X # Fold commit X into its parent (drops X's me
63
65
mergify stack fixup X Y Z # Fold each into its parent (multi-fixup)
64
66
mergify stack squash X into Y # Reorder X adjacent to Y, fold X into Y (keeps Y's message)
65
67
mergify stack squash X Y into Z -m "msg"# Fold X Y into Z with a custom message
68
+
mergify stack note -m "why"# Attach an amend reason to HEAD (shown in PR revision history)
69
+
mergify stack note <SHA-or-Change-Id-prefix> -m "why"# Attach to a specific commit in the stack
70
+
mergify stack note --append -m "more"# Append to an existing note
71
+
mergify stack note --remove # Remove the note from a commit
66
72
```
67
73
68
74
Use `mergify stack checkout NAME` to check out a stack that exists on GitHub (e.g. a colleague's stack). NAME is the remote branch name of the stack. It fetches all stacked PRs, creates a local branch, and sets up tracking. Use `--branch` to override the local branch name.
@@ -71,6 +77,31 @@ Use `mergify stack sync` to bring your stack up to date. It fetches the latest t
71
77
72
78
Use `mergify stack list` to see which commits have been pushed, which PRs they map to, and whether the stack is up to date with the remote. It also shows CI status, review status, and merge conflicts for each PR. Use `--verbose` for detailed check names and reviewer names. Use `--json` when you need to parse the output programmatically — it includes full CI check details and review data.
73
79
80
+
## Amend Notes
81
+
82
+
`mergify stack note` records *why* a commit was amended. The note travels with the stack:
83
+
84
+
- Stored locally under `refs/notes/mergify/stack` against the commit SHA.
85
+
- Pushed automatically by `mergify stack push` (alongside the commit refspecs, with `--force-with-lease`).
86
+
- Surfaced in the PR's **Revision history** comment as the `Reason` column of the markdown table, and embedded in the `<!-- mergify-revision-data: {...} -->` JSON marker (key `reason`) so it can be parsed programmatically.
87
+
88
+
**When to attach a note** — any time you amend or rewrite a commit that already has a PR open (i.e. it has been pushed at least once). The note answers "why is this revision different?" so the reviewer doesn't have to diff old vs new SHAs to find out.
89
+
90
+
**Workflow** — attach the note BEFORE `mergify stack push`:
91
+
92
+
```bash
93
+
# Edit HEAD, then:
94
+
git commit --amend
95
+
mergify stack note -m "address review: rename foo() to bar()"
96
+
mergify stack push
97
+
98
+
# Or for a mid-stack commit (after the rebase that amended it):
99
+
mergify stack note <SHA-or-Change-Id-prefix> -m "fix lint reported in CI"
100
+
mergify stack push
101
+
```
102
+
103
+
A note is per-commit, not per-revision. Each amend (or other history rewrite) creates a new commit SHA, so you must run `mergify stack note` again for the new SHA — the previous note stays attached to the old SHA and won't carry over. Use `--append` only when the current target commit already has a note and you want to add another reason; use `--remove` to clear it. Notes on commits that haven't changed since the last push are preserved but won't add a new revision row.
104
+
74
105
## CRITICAL: Check Branch Before ANY Commit
75
106
76
107
**BEFORE staging or committing anything**, always check the current branch and assess stack state:
0 commit comments