@aaronshaf/ger 4.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/gerrit-workflow/SKILL.md +228 -141
- package/skills/gerrit-workflow/examples.md +133 -426
- package/skills/gerrit-workflow/reference.md +470 -408
- package/src/cli/index.ts +1 -1
|
@@ -9,18 +9,19 @@ Real-world examples and workflows using the ger CLI tool.
|
|
|
9
9
|
Start your day by checking incoming review requests:
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
# Check what needs your review
|
|
12
|
+
# Check what needs your review (reviewer:self OR cc:self)
|
|
13
|
+
ger team
|
|
14
|
+
# or equivalently:
|
|
13
15
|
ger incoming
|
|
14
16
|
|
|
15
17
|
# Show detailed info for each change
|
|
16
18
|
ger show 12345
|
|
17
|
-
ger
|
|
18
|
-
ger show 12347
|
|
19
|
+
ger diff 12345
|
|
19
20
|
|
|
20
21
|
# Post reviews
|
|
21
22
|
ger comment 12345 -m "LGTM! Nice refactoring."
|
|
23
|
+
ger vote 12345 Code-Review +1
|
|
22
24
|
ger comment 12346 -m "Please add tests for the new method" --unresolved
|
|
23
|
-
ger comment 12347 -m "+1"
|
|
24
25
|
```
|
|
25
26
|
|
|
26
27
|
### Checking Your Own Changes
|
|
@@ -30,6 +31,8 @@ Monitor the status of your submitted changes:
|
|
|
30
31
|
```bash
|
|
31
32
|
# List your open changes
|
|
32
33
|
ger mine
|
|
34
|
+
# or:
|
|
35
|
+
ger list
|
|
33
36
|
|
|
34
37
|
# Check build status for each
|
|
35
38
|
ger build-status 12350 --watch
|
|
@@ -38,15 +41,12 @@ ger build-status 12350 --watch
|
|
|
38
41
|
ger comments 12350
|
|
39
42
|
|
|
40
43
|
# Address feedback with new patchset
|
|
41
|
-
# (make local changes, commit, push)
|
|
42
44
|
git add .
|
|
43
45
|
git commit --amend
|
|
44
46
|
ger push
|
|
45
47
|
```
|
|
46
48
|
|
|
47
|
-
###
|
|
48
|
-
|
|
49
|
-
If you want to push changes that aren't ready for review yet, you can use WIP:
|
|
49
|
+
### Work-in-Progress Changes
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
52
|
# Push as WIP (won't notify reviewers)
|
|
@@ -59,514 +59,221 @@ ger push --wip
|
|
|
59
59
|
|
|
60
60
|
# When ready for review
|
|
61
61
|
ger push --ready
|
|
62
|
-
|
|
62
|
+
# or:
|
|
63
|
+
ger set-ready -m "Ready for review"
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
# Find all WIP changes
|
|
67
|
-
ger search "is:wip"
|
|
68
|
-
|
|
69
|
-
# Your WIP changes only
|
|
65
|
+
# Find WIP changes
|
|
70
66
|
ger search "owner:self is:wip"
|
|
71
|
-
|
|
72
|
-
# Combine with other filters
|
|
73
|
-
ger search "owner:self is:wip project:my-project"
|
|
74
67
|
```
|
|
75
68
|
|
|
76
|
-
##
|
|
69
|
+
## Reviewing Changes with Worktrees
|
|
77
70
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
When reviewing large changes, examine each file individually:
|
|
71
|
+
Use worktrees to review a change in isolation without disturbing your current work:
|
|
81
72
|
|
|
82
73
|
```bash
|
|
83
|
-
#
|
|
84
|
-
ger
|
|
85
|
-
|
|
86
|
-
# Review file by file
|
|
87
|
-
ger diff 12345 --file src/api/client.ts
|
|
88
|
-
ger diff 12345 --file src/api/types.ts
|
|
89
|
-
ger diff 12345 --file tests/api/client.test.ts
|
|
90
|
-
|
|
91
|
-
# Post inline comments
|
|
92
|
-
ger comment 12345 --file src/api/client.ts --line 42 \
|
|
93
|
-
-m "Consider adding error handling for network failures"
|
|
94
|
-
|
|
95
|
-
ger comment 12345 --file src/api/types.ts --line 15 \
|
|
96
|
-
-m "This type should extend BaseResponse" --unresolved
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### Team Review Session
|
|
74
|
+
# Create a worktree for the change
|
|
75
|
+
ger tree setup 12345
|
|
100
76
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
```bash
|
|
104
|
-
# List all open changes
|
|
105
|
-
ger open --limit 20
|
|
106
|
-
|
|
107
|
-
# Filter by team member
|
|
108
|
-
ger open --owner alice@example.com
|
|
109
|
-
ger open --owner bob@example.com
|
|
110
|
-
|
|
111
|
-
# Quick status check
|
|
112
|
-
for id in 12345 12346 12347; do
|
|
113
|
-
echo "Change $id:"
|
|
114
|
-
ger build-status $id
|
|
115
|
-
ger comments $id --unresolved-only
|
|
116
|
-
echo "---"
|
|
117
|
-
done
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
### Managing Team Reviewers with Groups
|
|
121
|
-
|
|
122
|
-
Find and manage reviewer groups for your changes:
|
|
123
|
-
|
|
124
|
-
```bash
|
|
125
|
-
# Find all available groups
|
|
126
|
-
ger groups
|
|
127
|
-
|
|
128
|
-
# Find groups for your project
|
|
129
|
-
ger groups --project my-project
|
|
130
|
-
|
|
131
|
-
# Search for specific team groups
|
|
132
|
-
ger groups --pattern "^team-.*"
|
|
133
|
-
|
|
134
|
-
# View who's in a reviewer group before adding
|
|
135
|
-
ger groups-show project-reviewers
|
|
136
|
-
ger groups-members project-reviewers
|
|
137
|
-
|
|
138
|
-
# Add entire team as reviewers
|
|
139
|
-
ger add-reviewer --group project-reviewers -c 12345
|
|
140
|
-
|
|
141
|
-
# Add admin group as CC for visibility
|
|
142
|
-
ger add-reviewer --group administrators --cc -c 12345
|
|
143
|
-
|
|
144
|
-
# Add multiple groups
|
|
145
|
-
ger add-reviewer --group frontend-team -c 12345
|
|
146
|
-
ger add-reviewer --group backend-team -c 12345
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
**Practical workflow for finding the right reviewers:**
|
|
150
|
-
|
|
151
|
-
```bash
|
|
152
|
-
# Step 1: Find groups for your project
|
|
153
|
-
ger groups --project canvas-lms --pattern ".*-reviewers"
|
|
77
|
+
# Navigate into it
|
|
78
|
+
cd .ger/12345
|
|
154
79
|
|
|
155
|
-
#
|
|
156
|
-
ger groups-show canvas-frontend-reviewers
|
|
157
|
-
|
|
158
|
-
# Step 3: Add the group to your change
|
|
159
|
-
ger add-reviewer --group canvas-frontend-reviewers -c 12345
|
|
160
|
-
|
|
161
|
-
# Step 4: Verify they were added (check the change)
|
|
80
|
+
# Review the code
|
|
162
81
|
ger show 12345
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
**Automation example - add reviewers based on file changes:**
|
|
166
|
-
|
|
167
|
-
```bash
|
|
168
|
-
#!/bin/bash
|
|
169
|
-
# auto-add-reviewers.sh
|
|
170
|
-
|
|
171
|
-
CHANGE_ID=$1
|
|
82
|
+
ger diff 12345
|
|
172
83
|
|
|
173
|
-
#
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
if echo "$FILES" | grep -q "^src/api/"; then
|
|
178
|
-
ger add-reviewer --group api-team -c $CHANGE_ID
|
|
179
|
-
fi
|
|
180
|
-
|
|
181
|
-
if echo "$FILES" | grep -q "^src/frontend/"; then
|
|
182
|
-
ger add-reviewer --group frontend-team -c $CHANGE_ID
|
|
183
|
-
fi
|
|
184
|
-
|
|
185
|
-
if echo "$FILES" | grep -q "^db/migrations/"; then
|
|
186
|
-
ger add-reviewer --group database-team -c $CHANGE_ID
|
|
187
|
-
fi
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
## AI-Assisted Code Review
|
|
191
|
-
|
|
192
|
-
### Using AI for Automated Review
|
|
193
|
-
|
|
194
|
-
Integrate with AI tools for comprehensive code analysis:
|
|
195
|
-
|
|
196
|
-
```bash
|
|
197
|
-
# Get the diff
|
|
198
|
-
ger diff 12345 > /tmp/change.diff
|
|
84
|
+
# Make suggested fixes and push
|
|
85
|
+
git add .
|
|
86
|
+
git commit --amend
|
|
87
|
+
ger push
|
|
199
88
|
|
|
200
|
-
#
|
|
201
|
-
|
|
89
|
+
# Rebase onto latest main if needed
|
|
90
|
+
ger tree rebase
|
|
202
91
|
|
|
203
|
-
#
|
|
204
|
-
|
|
92
|
+
# Or interactive rebase
|
|
93
|
+
ger tree rebase --interactive
|
|
205
94
|
|
|
206
|
-
#
|
|
207
|
-
|
|
95
|
+
# When done, go back and clean up
|
|
96
|
+
cd -
|
|
97
|
+
ger tree cleanup 12345
|
|
208
98
|
```
|
|
209
99
|
|
|
210
|
-
|
|
100
|
+
## Cherry-Picking Changes
|
|
211
101
|
|
|
212
|
-
|
|
102
|
+
Grab a specific change into your current branch:
|
|
213
103
|
|
|
214
104
|
```bash
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
CHANGE_ID=$1
|
|
105
|
+
# Cherry-pick latest patchset
|
|
106
|
+
ger cherry 12345
|
|
219
107
|
|
|
220
|
-
#
|
|
221
|
-
|
|
222
|
-
DIFF=$(ger diff $CHANGE_ID)
|
|
108
|
+
# Cherry-pick specific patchset
|
|
109
|
+
ger cherry 12345/3
|
|
223
110
|
|
|
224
|
-
#
|
|
225
|
-
|
|
111
|
+
# Stage only (review before committing)
|
|
112
|
+
ger cherry 12345 --no-commit
|
|
113
|
+
git diff --staged # review changes
|
|
114
|
+
git commit
|
|
226
115
|
|
|
227
|
-
|
|
228
|
-
|
|
116
|
+
# Skip pre-commit hooks (use with care)
|
|
117
|
+
ger cherry 12345 --no-verify
|
|
229
118
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
Please provide:
|
|
234
|
-
1. Overall assessment
|
|
235
|
-
2. Potential bugs or issues
|
|
236
|
-
3. Performance concerns
|
|
237
|
-
4. Security considerations
|
|
238
|
-
5. Suggestions for improvement
|
|
239
|
-
"
|
|
240
|
-
|
|
241
|
-
# Get AI review
|
|
242
|
-
REVIEW=$(echo "$PROMPT" | ai-tool analyze)
|
|
243
|
-
|
|
244
|
-
# Post review
|
|
245
|
-
echo "$REVIEW" | ger comment $CHANGE_ID
|
|
246
|
-
|
|
247
|
-
echo "AI review posted to change $CHANGE_ID"
|
|
119
|
+
# From a Gerrit URL
|
|
120
|
+
ger cherry https://gerrit.instructure.com/c/canvas-lms/+/12345
|
|
248
121
|
```
|
|
249
122
|
|
|
250
|
-
|
|
251
|
-
```bash
|
|
252
|
-
./ai-gerrit-review.sh 12345
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
## CI/CD Integration
|
|
256
|
-
|
|
257
|
-
### Jenkins Build Monitoring
|
|
123
|
+
## CI/CD Workflows
|
|
258
124
|
|
|
259
|
-
|
|
125
|
+
### Wait for build, then get failures
|
|
260
126
|
|
|
261
127
|
```bash
|
|
262
|
-
#
|
|
263
|
-
ger build-status
|
|
264
|
-
|
|
265
|
-
# Wait for build to complete
|
|
266
|
-
ger build-status 12345 --watch --timeout 1800
|
|
267
|
-
|
|
268
|
-
# Extract build URL
|
|
269
|
-
ger extract-url "build-summary-report" 12345 | tail -1
|
|
128
|
+
# Full workflow: wait, then get failures
|
|
129
|
+
ger build-status --watch --interval 20 --timeout 1800 && \
|
|
130
|
+
ger extract-url "build-summary-report" | tail -1 | jk failures --smart --xml
|
|
270
131
|
|
|
271
|
-
#
|
|
272
|
-
ger build-status
|
|
273
|
-
ger extract-url "build-summary-report" 12345 | tail -1
|
|
132
|
+
# Just check status and exit non-zero on failure
|
|
133
|
+
ger build-status --exit-status
|
|
274
134
|
```
|
|
275
135
|
|
|
276
|
-
###
|
|
277
|
-
|
|
278
|
-
Create a script to monitor builds and notify on completion:
|
|
136
|
+
### Retrigger CI
|
|
279
137
|
|
|
280
138
|
```bash
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
CHANGE_ID=$1
|
|
285
|
-
SLACK_WEBHOOK=$2
|
|
286
|
-
|
|
287
|
-
echo "Monitoring build for change $CHANGE_ID..."
|
|
139
|
+
# Retrigger for the change in HEAD (auto-detected)
|
|
140
|
+
ger retrigger
|
|
288
141
|
|
|
289
|
-
#
|
|
290
|
-
|
|
291
|
-
STATUS="SUCCESS"
|
|
292
|
-
MESSAGE="Build passed for change $CHANGE_ID"
|
|
293
|
-
else
|
|
294
|
-
STATUS="FAILURE"
|
|
295
|
-
BUILD_URL=$(ger extract-url "build-summary-report" $CHANGE_ID | tail -1)
|
|
296
|
-
MESSAGE="Build failed for change $CHANGE_ID. See: $BUILD_URL"
|
|
297
|
-
fi
|
|
298
|
-
|
|
299
|
-
# Send notification
|
|
300
|
-
curl -X POST -H 'Content-type: application/json' \
|
|
301
|
-
--data "{\"text\":\"$MESSAGE\"}" \
|
|
302
|
-
$SLACK_WEBHOOK
|
|
303
|
-
|
|
304
|
-
echo "$STATUS"
|
|
142
|
+
# Retrigger a specific change
|
|
143
|
+
ger retrigger 12345
|
|
305
144
|
```
|
|
306
145
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
### Review Multiple Changes
|
|
310
|
-
|
|
311
|
-
Process multiple changes efficiently:
|
|
146
|
+
### Rebase a stale change
|
|
312
147
|
|
|
313
148
|
```bash
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
CHANGES=(12345 12346 12347 12348)
|
|
318
|
-
|
|
319
|
-
for CHANGE in "${CHANGES[@]}"; do
|
|
320
|
-
echo "Reviewing change $CHANGE..."
|
|
321
|
-
|
|
322
|
-
# Show change
|
|
323
|
-
ger show $CHANGE
|
|
324
|
-
|
|
325
|
-
# Wait for user input
|
|
326
|
-
read -p "Review comment (or 'skip'): " COMMENT
|
|
149
|
+
# Server-side rebase (Gerrit does the rebase)
|
|
150
|
+
ger rebase
|
|
327
151
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
echo "Comment posted to $CHANGE"
|
|
331
|
-
fi
|
|
152
|
+
# Rebase even with conflicts
|
|
153
|
+
ger rebase --allow-conflicts
|
|
332
154
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
echo "Batch review complete"
|
|
155
|
+
# Rebase onto a specific base
|
|
156
|
+
ger rebase --base origin/main
|
|
337
157
|
```
|
|
338
158
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
Clean up old changes:
|
|
159
|
+
## Analytics and Reporting
|
|
342
160
|
|
|
343
161
|
```bash
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
# Get your changes (assuming ger mine outputs change IDs)
|
|
348
|
-
CHANGES=$(ger mine --format json | jq -r '.[] | select(.updated < "2024-01-01") | .id')
|
|
349
|
-
|
|
350
|
-
for CHANGE in $CHANGES; do
|
|
351
|
-
echo "Change $CHANGE is stale"
|
|
352
|
-
read -p "Abandon? (y/n): " CONFIRM
|
|
162
|
+
# Year-to-date analytics (default: Jan 1 to today)
|
|
163
|
+
ger analyze
|
|
353
164
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
echo "Abandoned $CHANGE"
|
|
357
|
-
fi
|
|
358
|
-
done
|
|
359
|
-
```
|
|
360
|
-
|
|
361
|
-
## Troubleshooting Scenarios
|
|
362
|
-
|
|
363
|
-
### Debugging Failed Builds
|
|
165
|
+
# Specific date range
|
|
166
|
+
ger analyze --start-date 2025-01-01 --end-date 2025-06-30
|
|
364
167
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
```bash
|
|
368
|
-
# Get build status
|
|
369
|
-
ger build-status 12345
|
|
168
|
+
# Filter by repo
|
|
169
|
+
ger analyze --repo canvas-lms
|
|
370
170
|
|
|
371
|
-
#
|
|
372
|
-
|
|
171
|
+
# Export to different formats
|
|
172
|
+
ger analyze --markdown --output report.md
|
|
173
|
+
ger analyze --csv --output report.csv
|
|
174
|
+
ger analyze --json > analytics.json
|
|
373
175
|
|
|
374
|
-
#
|
|
375
|
-
ger
|
|
176
|
+
# Update local cache first
|
|
177
|
+
ger update && ger analyze
|
|
376
178
|
```
|
|
377
179
|
|
|
378
|
-
|
|
180
|
+
## Multi-File Review with Context
|
|
379
181
|
|
|
380
|
-
When
|
|
182
|
+
When reviewing large changes, examine each file individually:
|
|
381
183
|
|
|
382
184
|
```bash
|
|
383
|
-
#
|
|
384
|
-
ger
|
|
385
|
-
|
|
386
|
-
# Rebase onto latest main
|
|
387
|
-
git fetch origin
|
|
388
|
-
git rebase origin/main
|
|
389
|
-
|
|
390
|
-
# Resolve conflicts
|
|
391
|
-
# (edit files, git add, git rebase --continue)
|
|
392
|
-
|
|
393
|
-
# Push updated patchset
|
|
394
|
-
git push origin HEAD:refs/for/main
|
|
395
|
-
|
|
396
|
-
# Notify reviewers
|
|
397
|
-
ger comment 12345 -m "Rebased onto latest main and resolved merge conflicts. Ready for re-review."
|
|
398
|
-
```
|
|
399
|
-
|
|
400
|
-
### Recovery from Accidental Abandon
|
|
401
|
-
|
|
402
|
-
If you accidentally abandoned a change:
|
|
185
|
+
# Get overview
|
|
186
|
+
ger show 12345 --xml
|
|
403
187
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
# This is a placeholder for future functionality
|
|
188
|
+
# List changed files first
|
|
189
|
+
ger files 12345
|
|
407
190
|
|
|
408
|
-
#
|
|
409
|
-
ger
|
|
410
|
-
|
|
191
|
+
# Review file by file
|
|
192
|
+
ger diff 12345 --file src/api/client.ts
|
|
193
|
+
ger diff 12345 --file src/api/types.ts
|
|
411
194
|
|
|
412
|
-
#
|
|
413
|
-
ger comment
|
|
195
|
+
# Post inline comments
|
|
196
|
+
ger comment 12345 --file src/api/client.ts --line 42 \
|
|
197
|
+
-m "Consider adding error handling for network failures"
|
|
414
198
|
```
|
|
415
199
|
|
|
416
|
-
##
|
|
417
|
-
|
|
418
|
-
### Caching Strategies
|
|
419
|
-
|
|
420
|
-
Optimize performance with smart caching:
|
|
200
|
+
## Managing Teams / Reviewers
|
|
421
201
|
|
|
422
202
|
```bash
|
|
423
|
-
#
|
|
424
|
-
|
|
425
|
-
ger show $id > /dev/null 2>&1 &
|
|
426
|
-
done
|
|
427
|
-
wait
|
|
203
|
+
# Find groups for your project
|
|
204
|
+
ger groups --project canvas-lms
|
|
428
205
|
|
|
429
|
-
#
|
|
430
|
-
ger show
|
|
431
|
-
ger
|
|
432
|
-
ger show 12347
|
|
206
|
+
# View who's in a group before adding
|
|
207
|
+
ger groups-show canvas-frontend-reviewers
|
|
208
|
+
ger groups-members canvas-frontend-reviewers
|
|
433
209
|
|
|
434
|
-
#
|
|
435
|
-
ger
|
|
436
|
-
```
|
|
210
|
+
# Add entire team as reviewers
|
|
211
|
+
ger add-reviewer --group canvas-frontend-reviewers -c 12345
|
|
437
212
|
|
|
438
|
-
|
|
213
|
+
# Add manager as CC
|
|
214
|
+
ger add-reviewer --cc manager@example.com -c 12345
|
|
439
215
|
|
|
440
|
-
|
|
216
|
+
# Remove reviewer
|
|
217
|
+
ger remove-reviewer user@example.com -c 12345
|
|
441
218
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
for id in 12345 12346 12347 12348 12349; do
|
|
445
|
-
ger show $id
|
|
446
|
-
done
|
|
447
|
-
|
|
448
|
-
# Parallel (fast)
|
|
449
|
-
for id in 12345 12346 12347 12348 12349; do
|
|
450
|
-
ger show $id &
|
|
451
|
-
done
|
|
452
|
-
wait
|
|
219
|
+
# Suppress notifications when adding
|
|
220
|
+
ger add-reviewer --notify none user@example.com -c 12345
|
|
453
221
|
```
|
|
454
222
|
|
|
455
|
-
##
|
|
456
|
-
|
|
457
|
-
### Error Handling
|
|
223
|
+
## Batch Operations
|
|
458
224
|
|
|
459
|
-
|
|
225
|
+
### Check all changes in your review queue
|
|
460
226
|
|
|
461
227
|
```bash
|
|
462
228
|
#!/bin/bash
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
if [ -z "$CHANGE_ID" ]; then
|
|
468
|
-
echo "Error: Change ID required"
|
|
469
|
-
echo "Usage: $0 <change-id>"
|
|
470
|
-
exit 1
|
|
471
|
-
fi
|
|
472
|
-
|
|
473
|
-
# Check if change exists
|
|
474
|
-
if ! ger show $CHANGE_ID > /dev/null 2>&1; then
|
|
475
|
-
echo "Error: Change $CHANGE_ID not found"
|
|
476
|
-
exit 1
|
|
477
|
-
fi
|
|
478
|
-
|
|
479
|
-
# Proceed with operation
|
|
480
|
-
ger diff $CHANGE_ID
|
|
229
|
+
# Review incoming changes with filter
|
|
230
|
+
ger incoming --filter "project:canvas-lms" --xml | \
|
|
231
|
+
# process with your tool of choice
|
|
232
|
+
xq '.list_result.changes.change[]' -r '.change_number'
|
|
481
233
|
```
|
|
482
234
|
|
|
483
|
-
###
|
|
484
|
-
|
|
485
|
-
Use jq for parsing JSON output:
|
|
235
|
+
### Abandon stale changes
|
|
486
236
|
|
|
487
237
|
```bash
|
|
488
|
-
#
|
|
489
|
-
ger
|
|
490
|
-
ger
|
|
491
|
-
|
|
492
|
-
# Filter comments
|
|
493
|
-
ger comments 12345 --format json | jq '.[] | select(.unresolved == true)'
|
|
494
|
-
|
|
495
|
-
# Get list of changed files
|
|
496
|
-
ger show 12345 --format json | jq -r '.files[].path'
|
|
238
|
+
# Find your open changes as JSON
|
|
239
|
+
ger mine --json | jq -r '.[] | select(.updated < "2024-01-01") | .id' | \
|
|
240
|
+
xargs -I{} ger abandon {} -m "Abandoning stale change"
|
|
497
241
|
```
|
|
498
242
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
Create reusable functions:
|
|
502
|
-
|
|
503
|
-
```bash
|
|
504
|
-
# Add to ~/.bashrc or ~/.zshrc
|
|
505
|
-
|
|
506
|
-
# Quick review function
|
|
507
|
-
grev() {
|
|
508
|
-
local change_id=$1
|
|
509
|
-
ger show $change_id
|
|
510
|
-
echo ""
|
|
511
|
-
read -p "Comment: " comment
|
|
512
|
-
[ -n "$comment" ] && ger comment $change_id -m "$comment"
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
# Check build and extract URL
|
|
516
|
-
gbuild() {
|
|
517
|
-
local change_id=$1
|
|
518
|
-
ger build-status $change_id --watch && \
|
|
519
|
-
ger extract-url "build-summary-report" $change_id | tail -1
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
# AI review shortcut
|
|
523
|
-
gaireview() {
|
|
524
|
-
local change_id=$1
|
|
525
|
-
ger diff $change_id | ai-review-tool | ger comment $change_id
|
|
526
|
-
}
|
|
527
|
-
```
|
|
243
|
+
## Output Format Examples
|
|
528
244
|
|
|
529
|
-
Usage:
|
|
530
245
|
```bash
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
```
|
|
535
|
-
|
|
536
|
-
## Tips and Tricks
|
|
246
|
+
# JSON — good for scripting with jq
|
|
247
|
+
ger show 12345 --json | jq '.subject'
|
|
248
|
+
ger mine --json | jq '.[].change_number'
|
|
537
249
|
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
ger incoming --format json | jq -r '.[0].id' | xargs ger checkout
|
|
250
|
+
# XML — preferred for LLM/AI consumption
|
|
251
|
+
ger show 12345 --xml
|
|
252
|
+
ger incoming --xml
|
|
253
|
+
ger diff 12345 --xml
|
|
543
254
|
|
|
544
|
-
#
|
|
545
|
-
ger
|
|
255
|
+
# Plain text — human-readable colored output
|
|
256
|
+
ger team
|
|
257
|
+
ger mine
|
|
258
|
+
ger show 12345
|
|
546
259
|
```
|
|
547
260
|
|
|
548
|
-
|
|
261
|
+
## Shell Aliases
|
|
549
262
|
|
|
550
|
-
Add to your shell config:
|
|
263
|
+
Add to your shell config for quick access:
|
|
551
264
|
|
|
552
265
|
```bash
|
|
553
266
|
alias gm='ger mine'
|
|
554
267
|
alias gi='ger incoming'
|
|
555
|
-
alias
|
|
268
|
+
alias gt='ger team'
|
|
556
269
|
alias gs='ger show'
|
|
557
270
|
alias gd='ger diff'
|
|
558
271
|
alias gc='ger comment'
|
|
559
|
-
|
|
272
|
+
alias gp='ger push'
|
|
560
273
|
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
# Detailed table
|
|
568
|
-
ger open --format table
|
|
569
|
-
|
|
570
|
-
# Machine-readable
|
|
571
|
-
ger mine --format json | jq '.'
|
|
274
|
+
# Quick CI wait
|
|
275
|
+
gbuild() {
|
|
276
|
+
ger build-status --watch --interval 20 --timeout 1800 && \
|
|
277
|
+
ger extract-url "build-summary-report" | tail -1
|
|
278
|
+
}
|
|
572
279
|
```
|