26
26
<practice >Chain git commands with && for efficiency</practice >
27
27
<practice >Use --format options for structured output</practice >
28
28
<practice >Capture command output for parsing</practice >
29
+ <practice >Use GIT_EDITOR=true for non-interactive git rebase operations</practice >
30
+ <practice >Set environment variables inline to avoid prompts during automation</practice >
29
31
</best_practices >
30
32
31
33
<common_commands >
46
48
47
49
<command >
48
50
<purpose >Rebase onto main to reveal conflicts</purpose >
49
- <syntax >git rebase origin/main</syntax >
51
+ <syntax >GIT_EDITOR=true git rebase origin/main</syntax >
50
52
</command >
51
53
52
54
<command >
71
73
72
74
<command >
73
75
<purpose >Continue rebase after resolution</purpose >
74
- <syntax >git rebase --continue</syntax >
76
+ <syntax >GIT_EDITOR=true git rebase --continue</syntax >
75
77
</command >
76
78
</common_commands >
77
79
</tool >
@@ -152,7 +154,7 @@ const config = {
152
154
<step >execute_command - Get PR info with gh CLI</step >
153
155
<step >execute_command - Checkout PR with gh pr checkout --force</step >
154
156
<step >execute_command - Fetch origin main</step >
155
- <step >execute_command - Rebase onto origin/main</step >
157
+ <step >execute_command - Rebase onto origin/main with GIT_EDITOR=true </step >
156
158
<step >execute_command - Check for conflicts with git status</step >
157
159
</sequence >
158
160
</pattern >
@@ -178,13 +180,22 @@ const config = {
178
180
<pattern name =" complete_rebase" >
179
181
<sequence >
180
182
<step >execute_command - Check all conflicts resolved</step >
181
- <step >execute_command - Continue rebase with git rebase --continue</step >
183
+ <step >execute_command - Continue rebase with GIT_EDITOR=true git rebase --continue</step >
182
184
<step >execute_command - Verify clean status</step >
183
185
</sequence >
184
186
</pattern >
185
187
</tool_combination_patterns >
186
188
187
189
<error_handling >
190
+ <scenario name =" interactive_prompt_blocking" >
191
+ <description >Git commands waiting for interactive input</description >
192
+ <approach >
193
+ Use GIT_EDITOR=true to bypass editor prompts
194
+ Set GIT_SEQUENCE_EDITOR=true for sequence editing
195
+ Consider --no-edit flag for commit operations
196
+ </approach >
197
+ </scenario >
198
+
188
199
<scenario name =" no_conflicts_after_rebase" >
189
200
<description >Rebase completes without conflicts</description >
190
201
<approach >
@@ -225,4 +236,42 @@ const config = {
225
236
</approach >
226
237
</scenario >
227
238
</error_handling >
239
+
240
+ <non_interactive_operations >
241
+ <overview >
242
+ Ensuring git operations run without requiring user interaction is critical
243
+ for automated conflict resolution. The mode uses environment variables to
244
+ bypass interactive prompts.
245
+ </overview >
246
+
247
+ <techniques >
248
+ <technique name =" GIT_EDITOR" >
249
+ <description >Set to 'true' (a no-op command) to skip editor prompts</description >
250
+ <usage >GIT_EDITOR=true git rebase --continue</usage >
251
+ <when >During rebase operations that would normally open an editor</when >
252
+ </technique >
253
+
254
+ <technique name =" GIT_SEQUENCE_EDITOR" >
255
+ <description >Skip interactive rebase todo editing</description >
256
+ <usage >GIT_SEQUENCE_EDITOR=true git rebase -i HEAD~3</usage >
257
+ <when >When interactive rebase is triggered but no editing needed</when >
258
+ </technique >
259
+
260
+ <technique name =" commit_flags" >
261
+ <description >Use flags to avoid interactive prompts</description >
262
+ <examples >
263
+ <example >git commit --no-edit (use existing message)</example >
264
+ <example >git merge --no-edit (skip merge message editing)</example >
265
+ <example >git cherry-pick --no-edit (keep original message)</example >
266
+ </examples >
267
+ </technique >
268
+ </techniques >
269
+
270
+ <best_practices >
271
+ <practice >Always test commands locally first to identify potential prompts</practice >
272
+ <practice >Combine environment variables when multiple editors might be invoked</practice >
273
+ <practice >Document why non-interactive mode is used in comments</practice >
274
+ <practice >Have fallback strategies if automation fails</practice >
275
+ </best_practices >
276
+ </non_interactive_operations >
228
277
</merge_resolver_tool_usage >
0 commit comments