Class: Git::Commands::Log Private
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
arguments block audited against https://git-scm.com/docs/git-log/2.53.0
Implements the git log command.
Returns commit history.
Examples:
Typical usage
Typical usage
log = Git::Commands::Log.new(execution_context)
log.call
log.call(max_count: 20, since: '2 weeks ago')
log.call('v1.0..v2.0', pretty: 'format:%H %s', path: ['lib/', 'spec/'])
log.call(name_only: true, patch: true)
See Also:
Instance Method Summary collapse
-
#call(*revision_range, **options) ⇒ Git::CommandLine::Result
private
Execute the
git logcommand.
Methods inherited from Base
allow_exit_status, arguments, #initialize, requires_git_version, skip_version_validation
Constructor Details
This class inherits a constructor from Git::Commands::Base
Instance Method Details
#call(*revision_range, **options) ⇒ Git::CommandLine::Result
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Execute the git log command.
Commit Limiting
History Simplification
Commit Ordering
Object Traversal
Commit Formatting
Diff Formatting
Paths
Execution
Parameters:
-
revision_range
(Array<String>)
—
zero or more revision specifiers
Examples include
'v1.0..v2.0','abc123','^v0.9', or any expression accepted by git-log(1). When multiple values are given they are passed as separate positional arguments to git. Defaults to no revision constraint (i.e. all reachable commits). -
options
(Hash)
—
command options
Options Hash (**options):
-
:max_count
(Integer, String)
— default:
nil
—
maximum number of commits to output
Alias:
:n -
:skip
(Integer, String)
— default:
nil
—
skip this many commits before starting output
-
:since
(String)
— default:
nil
—
show commits more recent than the given date
Examples:
'2 weeks ago','2024-01-01' -
:after
(String)
— default:
nil
—
show commits more recent than the given date (synonym for
:since) -
:since_as_filter
(String)
— default:
nil
—
like
:sincebut visits all commits in the range rather than stopping at the first older commit -
:until
(String)
— default:
nil
—
show commits older than the given date
Examples:
'1 month ago','2024-01-01' -
:before
(String)
— default:
nil
—
show commits older than the given date (synonym for
:until) -
:author
(String)
— default:
nil
—
limit commits to those whose author line matches the given pattern (regular expression)
-
:committer
(String)
— default:
nil
—
limit commits to those whose committer line matches the given pattern (regular expression)
-
:grep_reflog
(String)
— default:
nil
—
limit commits to those with reflog entries matching the given pattern; requires
:walk_reflogs -
:grep
(String)
— default:
nil
—
limit commits to those whose log message matches the given pattern (regular expression)
-
:all_match
(Boolean, nil)
— default:
nil
—
limit output to commits matching all
--greppatterns (default: any) -
:invert_grep
(Boolean, nil)
— default:
nil
—
limit output to commits whose log message does not match the
:greppattern -
:regexp_ignore_case
(Boolean, nil)
— default:
nil
—
match
--grep,--author, and--committerpatterns case-insensitivelyAlias:
:i -
:basic_regexp
(Boolean, nil)
— default:
nil
—
treat limiting patterns as basic POSIX regular expressions (this is the default behavior)
-
:extended_regexp
(Boolean, nil)
— default:
nil
—
treat limiting patterns as extended POSIX regular expressions
Mutually exclusive with
:fixed_stringsand:perl_regexp. Alias::E -
:fixed_strings
(Boolean, nil)
— default:
nil
—
treat limiting patterns as fixed strings instead of regular expressions
Mutually exclusive with
:extended_regexpand:perl_regexp. Alias::F -
:perl_regexp
(Boolean, nil)
— default:
nil
—
treat limiting patterns as Perl-compatible regular expressions
Mutually exclusive with
:extended_regexpand:fixed_strings. Alias::P -
:remove_empty
(Boolean, nil)
— default:
nil
—
stop when a given path disappears from the tree
-
:merges
(Boolean, nil)
— default:
nil
—
include only merge commits (
--merges)Equivalent to
--min-parents=2. -
:no_merges
(Boolean, nil)
— default:
nil
—
exclude merge commits (
--no-merges)Equivalent to
--max-parents=1. -
:min_parents
(Integer, String)
— default:
nil
—
show only commits with at least this many parents
-
:max_parents
(Integer, String)
— default:
nil
—
show only commits with at most this many parents
-
:first_parent
(Boolean, nil)
— default:
nil
—
follow only the first parent commit upon seeing a merge commit
-
:exclude_first_parent_only
(Boolean, nil)
— default:
nil
—
when excluding commits with
^, follow only the first parent of merge commits -
:all
(Boolean, nil)
— default:
nil
—
pretend as if all refs in
refs/, along withHEAD, are listed on the command line -
:branches
(Boolean, String, nil)
— default:
nil
—
pretend as if all refs in
refs/headsare listed on the command linePass a shell glob pattern (e.g.
'feature*') to restrict to matching branch names -
:tags
(Boolean, String, nil)
— default:
nil
—
pretend as if all refs in
refs/tagsare listed on the command linePass a shell glob pattern to restrict to matching tag names
-
:remotes
(Boolean, String, nil)
— default:
nil
—
pretend as if all refs in
refs/remotesare listed on the command linePass a shell glob pattern to restrict to matching remote-tracking branches
-
:glob
(String)
— default:
nil
—
pretend as if all refs matching the given shell glob pattern are listed on the command line
-
:exclude
(String)
— default:
nil
—
do not include refs matching the given glob that
--all,--branches,--tags,--remotes, or--globwould otherwise use -
:exclude_hidden
(String)
— default:
nil
—
do not include refs hidden by the given configuration; value is one of
fetch,receive, oruploadpack -
:reflog
(Boolean, nil)
— default:
nil
—
pretend as if all objects mentioned by reflogs are listed on the command line
-
:alternate_refs
(Boolean, nil)
— default:
nil
—
pretend as if all objects mentioned as ref tips of alternate repositories are listed on the command line
-
:single_worktree
(Boolean, nil)
— default:
nil
—
examine only the current working tree when
--all,--reflog, or similar options are in use -
:ignore_missing
(Boolean, nil)
— default:
nil
—
ignore invalid object names in input
-
:bisect
(Boolean, nil)
— default:
nil
—
pretend as if the bad bisect ref was listed and the good bisect refs were excluded
-
:cherry_mark
(Boolean, nil)
— default:
nil
—
like
:cherry_pickbut marks equivalent commits with=instead of omitting them; inequivalent ones with +++ -
:cherry_pick
(Boolean, nil)
— default:
nil
—
omit commits that introduce the same change as a commit on the other side of a symmetric difference
-
:left_only
(Boolean, nil)
— default:
nil
—
list only commits reachable from the left side of a symmetric difference
-
:right_only
(Boolean, nil)
— default:
nil
—
list only commits reachable from the right side of a symmetric difference
-
:cherry
(Boolean, nil)
— default:
nil
—
synonym for
--right-only --cherry-mark --no-merges -
:walk_reflogs
(Boolean, nil)
— default:
nil
—
walk reflog entries from most recent to oldest instead of the commit ancestry chain
Alias:
:g -
:merge
(Boolean, nil)
— default:
nil
—
show commits touching conflicted paths in the range
HEAD...MERGE_HEAD; only useful with unmerged index entries -
:boundary
(Boolean, nil)
— default:
nil
—
output excluded boundary commits, prefixed with
- -
:simplify_by_decoration
(Boolean, nil)
— default:
nil
—
show only commits referenced by some branch or tag
-
:show_pulls
(Boolean, nil)
— default:
nil
—
include merge commits that are not TREESAME to their first parent but are TREESAME to a later parent
-
:full_history
(Boolean, nil)
— default:
nil
—
do not prune history; show all commits that touched the given path(s)
-
:dense
(Boolean, nil)
— default:
nil
—
show only commits not TREESAME to any parent
-
:sparse
(Boolean, nil)
— default:
nil
—
show all commits in the simplified history
-
:simplify_merges
(Boolean, nil)
— default:
nil
—
remove needless merges from the result of
:full_historywith parent rewriting -
:ancestry_path
(Boolean, String, nil)
— default:
nil
—
limit to commits on the ancestry chain between the range endpoints
Pass
truefor--ancestry-path; pass a commit SHA for--ancestry-path=<commit> -
:date_order
(Boolean, nil)
— default:
nil
—
show commits in commit timestamp order, no parents before all children
-
:author_date_order
(Boolean, nil)
— default:
nil
—
like
:date_orderbut ordered by author timestamp -
:topo_order
(Boolean, nil)
— default:
nil
—
avoid showing commits on multiple lines of history intermixed
-
:reverse
(Boolean, nil)
— default:
nil
—
output selected commits in reverse order; cannot be combined with
:walk_reflogs -
:no_walk
(Boolean, String, nil)
— default:
nil
—
show only the given commits without traversing ancestors
Pass
truefor--no-walk(sorted); pass"unsorted"for--no-walk=unsorted -
:do_walk
(Boolean, nil)
— default:
nil
—
override a previous
--no-walk -
:pretty
(Boolean, String, nil)
— default:
nil
—
pretty-print commit log in a format
Pass
truefor--pretty(mediumformat); pass a format name such as"oneline","short","full","fuller","email","raw", or aformat:<string>expression for--pretty=<format>.Alias:
:format -
:abbrev_commit
(Boolean, nil)
— default:
nil
—
abbreviate commit hash (
--abbrev-commit) -
:no_abbrev_commit
(Boolean, nil)
— default:
nil
—
do not abbreviate commit hash (
--no-abbrev-commit) -
:oneline
(Boolean, nil)
— default:
nil
—
shorthand for
--pretty=oneline --abbrev-commit -
:encoding
(String)
— default:
nil
—
re-encode the commit log message in the given character encoding before output
-
:expand_tabs
(Boolean, String, nil)
— default:
nil
—
expand tabs in log messages (
--expand-tabs)Pass
truefor--expand-tabs(width 8); pass an integer string like"4"for--expand-tabs=<n> -
:no_expand_tabs
(Boolean, nil)
— default:
nil
—
do not expand tabs in log messages (
--no-expand-tabs) -
:notes
(Boolean, String, nil)
— default:
nil
—
show notes annotating the commit (
--notes)Pass
truefor--notes; pass a ref string for--notes=<ref> -
:no_notes
(Boolean, nil)
— default:
nil
—
suppress notes output (
--no-notes) -
:show_notes_by_default
(Boolean, nil)
— default:
nil
—
show the default notes unless options for displaying specific notes are given
-
:show_signature
(Boolean, nil)
— default:
nil
—
verify a signed commit with
gpg --verify -
:relative_date
(Boolean, nil)
— default:
nil
—
show dates relative to the current time (synonym for
--date=relative) -
:date
(String)
— default:
nil
—
format for dates in human-readable output
Examples:
'relative','iso','short','format:%Y-%m-%d' -
:parents
(Boolean, nil)
— default:
nil
—
print the parents of each commit and enable parent rewriting
-
:children
(Boolean, nil)
— default:
nil
—
print the children of each commit and enable parent rewriting
-
:left_right
(Boolean, nil)
— default:
nil
—
mark which side of a symmetric difference a commit is reachable from (
<for left,>for right) -
:graph
(Boolean, nil)
— default:
nil
—
draw a text-based graphical representation of the commit history on the left side of output; implies
--topo-order -
:show_linear_break
(Boolean, String, nil)
— default:
nil
—
put a barrier between non-linear consecutive commits when
--graphis not usedPass
truefor--show-linear-break; pass a string for a custom barrier text -
:follow
(Boolean, nil)
— default:
nil
—
continue listing the history of a file beyond renames; requires
:pathto be set to exactly one path element -
:decorate
(Boolean, String, nil)
— default:
nil
—
print ref names of commits shown (
--decorate)Pass
truefor--decorate(short format); pass a string such as"full"for--decorate=<format> -
:no_decorate
(Boolean, nil)
— default:
nil
—
do not print ref names (
--no-decorate) -
:decorate_refs
(String)
— default:
nil
—
use only refs matching this pattern for decorations
-
:decorate_refs_exclude
(String)
— default:
nil
—
do not use refs matching this pattern for decorations
-
:clear_decorations
(Boolean, nil)
— default:
nil
—
clear all previous
--decorate-refs/--decorate-refs-excludeoptions -
:source
(Boolean, nil)
— default:
nil
—
print the ref name by which each commit was reached
-
:use_mailmap
(Boolean, nil)
— default:
nil
—
use the mailmap file to map author/ committer names and addresses to canonical real names (
--use-mailmap) -
:no_use_mailmap
(Boolean, nil)
— default:
nil
—
disable mailmap substitution (
--no-use-mailmap) -
:full_diff
(Boolean, nil)
— default:
nil
—
show full diff for commits touching the specified paths, not just the diff for those paths
-
:log_size
(Boolean, nil)
— default:
nil
—
include a
log size <n>line for each commit indicating the length of the commit message in bytes -
:patch
(Boolean, nil)
— default:
nil
—
generate patch output
Alias:
:p -
:no_patch
(Boolean, nil)
— default:
nil
—
suppress all diff output
Alias:
:s -
:diff_merges
(String)
— default:
nil
—
diff format for merge commits
Values:
"off","on","first-parent","separate","combined","dense-combined","remerge" -
:no_diff_merges
(Boolean, nil)
— default:
nil
—
disable diff output for merge commits (synonym for
--diff-merges=off) -
:combined_all_paths
(Boolean, nil)
— default:
nil
—
in combined diffs, list the file name from all parents; only meaningful with
-cor--cc -
:raw
(Boolean, nil)
— default:
nil
—
show a summary of changes using the raw diff format for each commit
-
:stat
(Boolean, String, nil)
— default:
nil
—
generate a diffstat
Pass
truefor--stat; pass a string such as"80,40"for--stat=<width>[,<name-width>[,<count>]] -
:compact_summary
(Boolean, nil)
— default:
nil
—
output a condensed summary of extended header information in diffstat; implies
--stat -
:numstat
(Boolean, nil)
— default:
nil
—
like
--statbut shows numbers of added and deleted lines in decimal notation without abbreviation -
:shortstat
(Boolean, nil)
— default:
nil
—
output only the last line of the
--statformat -
:dirstat
(Boolean, String, nil)
— default:
nil
—
output distribution of relative amount of changes per sub-directory
Pass
truefor--dirstat; pass a parameter string such as"files,10"for--dirstat=<params> -
:summary
(Boolean, nil)
— default:
nil
—
output a condensed summary of extended header information such as creations, renames, and mode changes
-
:name_only
(Boolean, nil)
— default:
nil
—
show only the names of changed files
-
:name_status
(Boolean, nil)
— default:
nil
—
show only the names and status of changed files
-
:submodule
(Boolean, String, nil)
— default:
nil
—
specify how differences in submodules are shown
Pass
truefor--submodule(log format); pass"short","log", or"diff"for--submodule=<format> -
:color
(Boolean, String, nil)
— default:
nil
—
show colored diff output (
--color)Pass
truefor--color; pass a string such as"always"for--color=<when> -
:no_color
(Boolean, nil)
— default:
nil
—
suppress colored diff output (
--no-color) -
:full_index
(Boolean, nil)
— default:
nil
—
show the full pre- and post-image blob object names on the index line of patch output
-
:binary
(Boolean, nil)
— default:
nil
—
output a binary diff that can be applied with
git apply; implies--patch -
:abbrev
(Boolean, String, nil)
— default:
nil
—
show the shortest unique object name prefix in diff-raw output
Pass
truefor--abbrev; pass an integer string for--abbrev=<n> -
:diff_filter
(String)
— default:
nil
—
select files by status letter (e.g.
"AD"for Added and Deleted) -
:find_renames
(Boolean, String, nil)
— default:
nil
—
detect renames
Pass
truefor--find-renames; pass a percentage threshold string such as"90"for--find-renames=<n> -
:find_copies
(Boolean, String, nil)
— default:
nil
—
detect copies as well as renames
Pass
truefor--find-copies; pass a threshold string for--find-copies=<n> -
:find_copies_harder
(Boolean, nil)
— default:
nil
—
inspect unmodified files as candidates for copy source; expensive for large projects
-
:relative
(Boolean, String, nil)
— default:
nil
—
show pathnames relative to the given subdirectory, or the current directory when run from a subdirectory (
--relative)Pass
truefor--relative; pass a path string for--relative=<path> -
:no_relative
(Boolean, nil)
— default:
nil
—
show absolute pathnames (
--no-relative) -
:text
(Boolean, nil)
— default:
nil
—
treat all files as text; alias
-a -
:ignore_space_at_eol
(Boolean, nil)
— default:
nil
—
ignore changes in whitespace at end of line
-
:ignore_space_change
(Boolean, nil)
— default:
nil
—
ignore changes in amount of whitespace; alias
-b -
:ignore_all_space
(Boolean, nil)
— default:
nil
—
ignore whitespace when comparing lines; alias
-w -
:ignore_blank_lines
(Boolean, nil)
— default:
nil
—
ignore changes whose lines are all blank
-
:ignore_matching_lines
(String)
— default:
nil
—
ignore changes whose all lines match the given regular expression
-
:ext_diff
(Boolean, nil)
— default:
nil
—
allow external diff helpers (
--ext-diff) -
:no_ext_diff
(Boolean, nil)
— default:
nil
—
disallow external diff helpers (
--no-ext-diff) -
:textconv
(Boolean, nil)
— default:
nil
—
allow external text conversion filters when comparing binary files (
--textconv) -
:no_textconv
(Boolean, nil)
— default:
nil
—
disallow external text conversion filters (
--no-textconv) -
:no_prefix
(Boolean, nil)
— default:
nil
—
do not show any source or destination prefix
-
:src_prefix
(String)
— default:
nil
—
show the given source prefix instead of
a/ -
:dst_prefix
(String)
— default:
nil
—
show the given destination prefix instead of
b/ -
:path
(Array<String>)
— default:
nil
—
limit commits to those that affected the given paths
-
:timeout
(Integer, Float)
— default:
nil
—
number of seconds to wait before the command is aborted with a timeout error
Returns:
-
(Git::CommandLine::Result)
—
the result of calling
git log
Raises:
-
(ArgumentError)
—
if unsupported options are provided
-
(Git::FailedError)
—
if git exits with a non-zero exit status
629 630 631 |
# File 'lib/git/commands/log.rb', line 629 def call(*, **) super end |