# Commit log

Repository.walk(oid: Oid | None, sort_mode: enums.SortMode = enums.SortMode.NONE) → Walker

  Start traversing the history from the given commit. The following SortMode values can be used to control the walk:

  - NONE. Sort the output with the same default method from git: reverse chronological order. This is the default sorting for new walkers.

  - TOPOLOGICAL. Sort the repository contents in topological order (no parents before all of its children are shown); this sorting mode can be combined with time sorting to produce git’s –date-order`.

  - TIME. Sort the repository contents by commit time; this sorting mode can be combined with topological sorting.

  - REVERSE. Iterate through the repository contents in reverse order; this sorting mode can be combined with any of the above.

  Example:

      >>> from pygit2 import Repository
      >>> from pygit2.enums import SortMode
      >>> repo = Repository('.git')
      >>> for commit in repo.walk(repo.head.target, SortMode.TOPOLOGICAL):
      ...    print(commit.message)
      >>> for commit in repo.walk(repo.head.target, SortMode.TOPOLOGICAL | SortMode.REVERSE):
      ...    print(commit.message)
      >>>

Walker.hide(oid: Oid)

  Mark a commit (and its ancestors) uninteresting for the output.

Walker.push(oid: Oid)

  Mark a commit to start traversal from.

Walker.reset()

  Reset the walking machinery for reuse.

Walker.sort(mode: enums.SortMode)

  Change the sorting mode (this resets the walker).

Walker.simplify_first_parent()

  Simplify the history by first-parent.