git_history {git4r} | R Documentation |
Git Display History and Select Commit
Description
Display the history of commits in a specific branch with the option to filter.
The list of commits is returned invisibly and can be extracted using [[i]]
alternatively use git_get()
to return the newest commit after filtering.
Usage
git_history(path = ".", branch = NULL, top = 10, ...)
git_get(path = ".", branch = NULL, ...)
Arguments
path |
Only display / search commits which affect this path (dir or file) |
branch |
Name of branch to display. If a match cannot be found with git_get() in this branch, all branches are searched. Remote branches can be viewed by using the format "origin/master" providing that fetch or pull has downloaded changes. |
top |
Maximum number of commits to display (post-filtering) |
... |
Filters such as before='2021-01-01' or author='somebody' |
Details
By default the history of the current branch is returned. The commits of a remote
branch can be found using branch='origin/master
, for example.
The following filter arguments can be given:
-
n
- integer vector of commits back from latest (1 = most recent commit) -
hash
- character to match the beginning of commit hash -
before
andafter
- date object or string like '2021-01-31' -
message
- regular expression string to find in commit message -
author
andemail
- regular expression string of author or email of the commit
If nothing could be matched, get_git()
will start looking on other branches,
for example when looking for a particular hash. The user is notified if this
happens.
Value
Return the git_commit object which best matches a wide variety of types. This is used for git_diff() and git_checkout().
Vector of commit objects invisibly
Single commit object