From 029621b916614234ca87a6bfdacc6a7a1cc9dfa7 Mon Sep 17 00:00:00 2001 From: Gregory Gauthier Date: Tue, 31 Mar 2026 11:31:03 +0100 Subject: [PATCH] refactor(prdescribe): prefer remote base for diff calculation Update the git diff command to first attempt using the remote origin/base branch, as it is more likely to be up-to-date for pull requests. Fall back to the local base branch if the remote diff fails or is empty. --- cmd/prdescribe.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/prdescribe.go b/cmd/prdescribe.go index edc5415..08689c4 100644 --- a/cmd/prdescribe.go +++ b/cmd/prdescribe.go @@ -26,10 +26,10 @@ func init() { func runPRDescribe(cmd *cobra.Command, _ []string) { base, _ := cmd.Flags().GetString("base") - // Prefer local base, fallback to origin/. - diff, err := gitDiff([]string{"diff", fmt.Sprintf("%s..HEAD", base), "--no-color"}) + // Prefer remote (more likely up-to-date for PRs), fallback to local. + diff, err := gitDiff([]string{"diff", fmt.Sprintf("origin/%s..HEAD", base), "--no-color"}) if err != nil || strings.TrimSpace(diff) == "" { - diff, err = gitDiff([]string{"diff", fmt.Sprintf("origin/%s..HEAD", base), "--no-color"}) + diff, err = gitDiff([]string{"diff", fmt.Sprintf("%s..HEAD", base), "--no-color"}) if err != nil { color.Red("Failed to get branch diff: %v", err) return