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
@@ -20,17 +20,20 @@ If no argument is provided, PR description will only be updated if there are sta
20
20
```
21
21
0. Verify MCP authentication
22
22
1. Verify existing PR context
23
-
2. Amend changes to current commit
24
-
3. Push updated commit
25
-
4. Update PR description (if needed)
26
-
5. Display summary
23
+
2. Analyze staged changes with gt absorb --dry-run
24
+
3. Determine optimal commit placement (absorb vs amend)
25
+
4. User confirmation with absorb analysis
26
+
5. Apply changes (absorb or amend)
27
+
6. Push updated commits
28
+
7. Update PR description (if needed)
29
+
8. Display summary
27
30
```
28
31
29
32
## Detailed Process
30
33
31
34
### Step 0: Verify MCP Authentication (MUST BE FIRST)
32
35
33
-
> **⚠️ CRITICAL**: This step MUST be executed BEFORE any other operation. Do NOT skip or defer this step. Do NOT read files, check git status, or perform any other action until MCP authentication is verified.
36
+
> **CRITICAL**: This step MUST be executed BEFORE any other operation. Do NOT skip or defer this step. Do NOT read files, check git status, or perform any other action until MCP authentication is verified.
34
37
35
38
Verify that Atlassian MCP is authenticated before starting the workflow.
- Inform the user that Atlassian MCP needs re-authentication
45
48
- Provide guidance on how to re-authenticate:
46
49
```
47
-
⚠️ MCP Authentication Required
50
+
MCP Authentication Required
48
51
49
52
Atlassian MCP needs re-authentication.
50
53
Please re-authenticate via MCP settings and run the command again.
@@ -72,7 +75,7 @@ git diff --cached --stat
72
75
73
76
**If no PR exists for current branch:**
74
77
```
75
-
⚠️ No PR Found
78
+
No PR Found
76
79
77
80
Current branch does not have an associated PR.
78
81
Use /submit-staged-changes to create a new Jira issue and PR.
@@ -83,31 +86,88 @@ Use /submit-staged-changes to create a new Jira issue and PR.
83
86
- Extract PR number, title, URL, and current body
84
87
- Proceed to Step 2
85
88
86
-
### Step 2: Analyze Changes
89
+
### Step 2: Analyze Changes with gt absorb
87
90
88
91
```bash
89
92
# View staged changes
90
93
git diff --cached
91
94
92
-
#View current commit message
93
-
git log -1 --format="%B"
95
+
#Run gt absorb in dry-run mode to analyze where changes could go
96
+
mcp__graphite__run_gt_cmd with args: ["absorb", "--dry-run"]
94
97
```
95
98
96
-
- Review staged changes to understand what's being amended
97
-
-If no staged changes and `--update-desc` not provided:
98
-
```
99
-
ℹ️ No Staged Changes
99
+
**gt absorb Analysis:**
100
+
-`gt absorb` analyzes staged hunks and determines which commits in the stack they logically belong to
101
+
- It considers the blame of modified lines to find the original commit that introduced them
102
+
- Dry-run shows which changes would go to which commits WITHOUT making changes
100
103
101
-
No staged changes to amend. Use --update-desc flag to update PR description only.
102
-
Or stage your changes first:
103
-
git add <files>
104
-
```
105
-
- Exit the workflow
104
+
**If no staged changes and `--update-desc` not provided:**
105
+
```
106
+
No Staged Changes
107
+
108
+
No staged changes to amend. Use --update-desc flag to update PR description only.
109
+
Or stage your changes first:
110
+
git add <files>
111
+
```
112
+
- Exit the workflow
113
+
114
+
### Step 3: Evaluate Absorb Results
115
+
116
+
Analyze the `gt absorb --dry-run` output and determine the best approach:
106
117
107
-
### Step 3: User Confirmation
118
+
**Scenario A: All changes belong to current commit**
119
+
- No cross-PR dependencies
120
+
- Simple amend is appropriate
108
121
109
-
**IMPORTANT**: Present confirmation before making changes:
122
+
**Scenario B: Changes can be absorbed into different commits**
123
+
- Some hunks belong to commits in other PRs in the stack
124
+
- Consider separation of concerns between PRs
125
+
- Evaluate if absorbing maintains clean PR boundaries
126
+
127
+
**Scenario C: Mixed - some absorb, some amend**
128
+
- Some changes fit better in downstack PRs
129
+
- Some changes are new to current PR
130
+
131
+
**Decision Criteria:**
132
+
1.**Separation of Concerns**: Does absorbing maintain clean PR boundaries?
133
+
2.**PR Dependencies**: Will absorbing create unintended dependencies?
134
+
3.**Review Impact**: How will absorbed changes affect PRs already under review?
135
+
4.**Logical Grouping**: Do the changes logically belong together?
136
+
137
+
### Step 4: User Confirmation with Absorb Analysis
138
+
139
+
**IMPORTANT**: Present confirmation with detailed absorb analysis:
140
+
141
+
**If absorb candidates exist:**
142
+
```
143
+
AskUserQuestion({
144
+
questions: [{
145
+
question: "How would you like to apply the staged changes?",
146
+
header: "Change Placement",
147
+
multiSelect: false,
148
+
options: [
149
+
{
150
+
label: "Absorb to Best Fit (Recommended)",
151
+
description: "gt absorb analysis:\n\n[Absorb dry-run output]\n\nThis distributes changes to the commits where they logically belong, maintaining clean PR separation."
152
+
},
153
+
{
154
+
label: "Amend Current Only",
155
+
description: "Add all changes to current commit only.\nUse when changes are specific to this PR regardless of file history."
156
+
},
157
+
{
158
+
label: "Review Details First",
159
+
description: "Show detailed analysis of each hunk and its target commit before deciding."
160
+
},
161
+
{
162
+
label: "Cancel",
163
+
description: "Don't make any changes"
164
+
}
165
+
]
166
+
}]
167
+
})
168
+
```
110
169
170
+
**If no absorb candidates (all changes for current commit):**
111
171
```
112
172
AskUserQuestion({
113
173
questions: [{
@@ -132,26 +192,60 @@ AskUserQuestion({
132
192
})
133
193
```
134
194
135
-
### Step 4: Amend Commit
195
+
**If user selects "Review Details First":**
196
+
Present detailed breakdown:
197
+
```
198
+
Absorb Analysis Details:
199
+
200
+
Commit abc1234 (PR #1001 - feat: add user settings)
0 commit comments