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/2015
$ 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
    Show all branches, tags, and remote refs.

--branches[=pattern]
    Limit to branches matching pattern; -a synonym.

--tags[=pattern]
    Limit to tags matching pattern.

--remotes[=pattern]
    Limit to remote-tracking branches matching pattern.

--glob=pattern
    Show refs matching shell glob pattern.

--since[=<time>]
    Show commits newer than a date or relative time.

--until[=<time>]
    Show commits older than a date or relative time.

--date-order
    Sort commits by date instead of topo-order.

--author[=<name>]
    Limit to commits by author matching name.

--committer[=<name>]
    Limit to commits by committer matching name.

--grep=<pattern>
    Limit to commits with pattern in message.

-R
    Process submodules recursively.

--full-diff
    Show full diffs in patch view.

--relative-date
    Use relative dates in display.

--max-count=<n>
    Limit to first n commits.

DESCRIPTION

gitk is a Tcl/Tk-based graphical tool for visualizing and exploring Git repository history. It displays commits in a timeline view, showing branches, tags, and remotes as trees. Users can select commits to view details like author, date, message, and file changes with diffs.

Key capabilities include searching commits by text, author, or date; comparing revisions side-by-side; viewing blame for files; and bisecting history interactively. It supports filtering by paths, time ranges, or refs, making it ideal for code reviews, debugging merges, or understanding project evolution.

Invoked from the command line, gitk opens an intuitive GUI where navigation uses mouse clicks, keyboard shortcuts, or menus. It integrates seamlessly with Git workflows, complementing command-line tools. While powerful for visual analysis, it requires a graphical environment (X11/Wayland) and Tcl/Tk libraries.

Best for developers needing a quick overview without terminal complexity, though large repositories may load slowly.

CAVEATS

Requires Tcl/Tk and graphical display (X11/Wayland); slow on massive repos; no native Windows/Mac support without extras; lacks modern UI polish compared to alternatives like GitKraken.

KEY SHORTCUTS

q or Ctrl+q: quit
Space: toggle diffstat/full diff
Enter: view commit details
/: search commits
t: tree browser
b: blame current file.

LAUNCHING TIPS

Run gitk --all for full history; gitk HEAD~10.. for recent changes; use -- to separate revs from paths.

HISTORY

Created by Paul Mackerras in 2005 shortly after Git's inception, as an early GUI companion. Maintained within Git project; enhancements track Git evolution, with focus on stability over new features.

SEE ALSO

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

Copied to clipboard