gh_message_search: Search commit messages and link the hits on GitHub.

View source: R/gh.R

gh_message_searchR Documentation

Description

gh_message_search asks git for commits on the current branch whose message matches regex, and prints the newest max of them. sort = "asc" flips that set so the oldest of those hits is first.

The pattern is applied to the whole commit message. Each row has a number, the date, a short sha, and the subject. The subject is only the first line, so the match may be further down the message. When origin is a GitHub remote, the row also has the commit page. Pass open as that row number to show it in the browser. The same page is hits$url[n] on the data.frame returned.

regex is an extended regular expression (⁠git log -E --grep⁠). A plain word works as-is. +, ⁠()⁠, and | are special; escape them to match those characters literally. Matching ignores case unless ignore_case = FALSE.

Usage

gh_message_search(
  regex,
  repo = "~/bin/umx",
  max = 10,
  sort = c("desc", "asc"),
  ignore_case = TRUE,
  open = NULL
)

Arguments

regex

Pattern matched against the commit message.

repo

Local checkout. Default "~/bin/umx".

max

How many of the newest matches to keep. Default 10.

sort

"desc" (newest first) or "asc". Default "desc".

ignore_case

Default TRUE.

open

Row number to open on GitHub. Default NULL (print only).

Value

A data.frame (invisibly) with columns n, date, sha, short, subject, url.

See Also

Other github: gh_feature_branch(), gh_open_PR_url(), xgh_check_base_name(), xgh_get_current_branch()

Examples

## Not run: 
hits <- gh_message_search("double entry")
gh_message_search("double entry", open = 1)

## End(Not run)

umx documentation built on Oct. 11, 2026, 5:07 p.m.