gituto/doc/git_logs.org

2.1 KiB
Raw Permalink Blame History

Pro Git book notes

List git history

Argument "-p" stands for listing patchs in git log and the number can be used to limit the number of commit that should be printed

   git log -p -3

The following arguments can be used with git log:

  • --stat
  • --pretty

    • --pretty=oneline
    • --pretty=format:"%h - %an, %ar : %s"
    • --pretty=format:'%h %s' --graph
Table 1 Specifiers for git log pretty=format 1
Specifier Output description
%H Commit hash
%h Abbreviated commit hash
%T Tree hash
%t Abbreviated tree hash
%P Parent hashes
%p Abbreviated parent hashes
%an Author name
%ae Author email
%ad Author date (format respects the date=option)
%ar Author date, relative
%cn Committer name
%ce Committer email
%cd Committer date
%cr Committer date, relative
%s Subject

1

From Pro Git book

Limiting git log options

   git log --since=2.weeks
  git log --until="2021-01-15"

Look for commits that changed the occurrences of a string

  git log -S string_name

Filter by path

  git log -- directory/