LinuxCommandLibrary

gitk

Visually browse Git repository history

TLDR

Show the repository browser for the current Git repository

$ gitk
copy

Show repository browser for a specific file or directory
$ gitk [path/to/file_or_directory]
copy

Show commits made since 1 week ago
$ gitk --since="[1 week ago]"
copy

Show commits older than 1/1/2016
$ gitk --until="[1/1/2015]"
copy

Show at most 100 changes in all branches
$ gitk --max-count=100 --all
copy

SYNOPSIS

gitk [<options>] [<revision-range>] [--] [<path>...]

PARAMETERS

--all
    Shows all branches, tags, and remote-tracking branches in the history view.

--branches[=<pattern>]
    Includes commits reachable from all local branches, optionally filtered by a shell-style <pattern>.

--tags[=<pattern>]
    Includes commits reachable from all tags, optionally filtered by a shell-style <pattern>.

--remotes[=<pattern>]
    Includes commits reachable from all remote-tracking branches, optionally filtered by a shell-style <pattern>.

--since=<date>
    Shows commits more recent than a specific <date> (e.g., '2 weeks ago', '2023-01-01').

--until=<date>
    Shows commits older than a specific <date>.

--max-count=<n>
-<n>

    Limits the number of commits to display to the first <n> found.

--author=<pattern>
    Shows commits where the author's name or email matches the specified regular expression <pattern>.

--committer=<pattern>
    Shows commits where the committer's name or email matches the specified regular expression <pattern>.

--grep=<pattern>
    Shows commits with a log message that matches the specified regular expression <pattern>.

<revision-range>
    Specifies a range of revisions to display (e.g., master..feature to show commits on 'feature' but not 'master').

-- <path>...
    Limits the commits displayed to those that affect the specified <path>(s). Use '--' to separate paths from revisions.

--select-commit <sha1>
    Starts gitk with the commit identified by <sha1> pre-selected in the view.

DESCRIPTION

gitk is a Tcl/Tk based graphical user interface for browsing the history of a Git repository. It provides a visual representation of the commit graph, allowing users to easily inspect individual commits, view the diff of changes introduced by a commit, and understand the branching and merging history. It's an invaluable tool for quickly visualizing the state and evolution of a Git repository. Users can filter commits by various criteria such as author, committer, commit message, and date, making it efficient to locate specific changes or understand contributions over time. Being part of the official Git distribution, it offers a reliable and readily available graphical view of repository history.

CAVEATS

Requires a Tcl/Tk installation to run, which might not be pre-installed on all systems. While functional and reliable, its user interface and feature set may appear less modern or extensive compared to newer, dedicated graphical Git clients. Performance can be slower on extremely large repositories with a vast number of commits.

USER INTERFACE OVERVIEW

The gitk window typically consists of several key panes:
A history graph pane (usually top-left) displays commits and their relationships, showing branches, merges, and tags.
A commit details pane (top-right) provides comprehensive information about the currently selected commit, including its hash, author, committer, date, and full commit message.
A diff pane (bottom) shows the changes introduced by the selected commit, allowing users to inspect modified files and their line-by-line differences.
Additionally, it features a search bar and various filter options to narrow down the displayed history based on different criteria.

CONFIGURATION

gitk's appearance and default behavior are highly customizable through Git's configuration system. Users can modify settings in the global ~/.gitconfig file or the repository-specific .git/config file. This includes customization of colors for different elements (e.g., branches, tags), fonts, the visibility of columns in the history list, and default sorting orders, allowing for a personalized viewing experience.

HISTORY

gitk has been an integral part of the official Git distribution since its early days, providing a robust, native graphical history browser. It's written in Tcl/Tk, a cross-platform scripting language with a GUI toolkit, which contributed to its early accessibility and widespread adoption as a default Git GUI tool for visualizing repository history.

SEE ALSO

git(1), git-log(1), git-diff(1), git-gui(1)

Copied to clipboard