Skip to content

Commit e74cb86

Browse files
committed
fix(ci): Fix diff to compute merge base first
1 parent 09a089b commit e74cb86

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

.claude/skills/techdebt/SKILL.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,22 @@ Analyze changes on the current branch to identify and fix technical debt, code d
1818

1919
### Step 1: Get Branch Changes
2020

21-
Find the upstream remote and compare against it:
21+
Find the merge-base (where this branch diverged from master) and compare against it:
2222

2323
```bash
24-
# Find upstream (DataDog org repo) and show changes
24+
# Find upstream (DataDog org repo)
2525
UPSTREAM=$(git remote -v | grep -E 'DataDog/[^/]+(.git)?\s' | head -1 | awk '{print $1}')
2626
if [ -z "$UPSTREAM" ]; then
2727
echo "No DataDog upstream found, using origin"
2828
UPSTREAM="origin"
2929
fi
30-
echo "Comparing against: $UPSTREAM/master"
31-
git diff ${UPSTREAM}/master --stat
32-
git diff ${UPSTREAM}/master --name-status
30+
31+
# Find the merge-base (commit where this branch diverged from master)
32+
MERGE_BASE=$(git merge-base HEAD ${UPSTREAM}/master)
33+
echo "Comparing changes introduced on this branch since diverging from master using base commit: $MERGE_BASE"
34+
35+
git diff $MERGE_BASE --stat
36+
git diff $MERGE_BASE --name-status
3337
```
3438

3539
If no changes exist, inform the user and stop.

0 commit comments

Comments
 (0)