Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works

Random project

gitlinehistory

Find the last Git commit that changed a specific line, shown in a side-by-side diff viewer. A Lazarus/Free Pascal GUI tool for Windows.

View on GitLab

Anyone may press Interesting, signed in or not. It helps others find this project.

Member rating

No ratings yet.

Sign in to rate this project.

README

GitLineHistory

Find the last change to a specific line — for Git, with a side-by-side diff.

GitLineHistory is a standalone Windows GUI tool (Lazarus/Free Pascal) that answers the question "which commit last changed this line?" and shows the answer visually: the file history in a grid on the left, and a side-by-side diff of the selected commit against its parent on the right, positioned exactly on the line you asked about.

It is designed to be launched from an editor or IDE plugin with a file path and line number, replicating the classic "Find last change to this line" workflow (as known from VssConnexion) for Git repositories.

Download

Pre-built Windows x86-64 binaries are attached to each release. A single GitLineHistory.exe with no installer, no runtime and no registry use — drop it anywhere and run it.

The binary is not code-signed, so Windows SmartScreen will warn on first run (More info → Run anyway). Each release lists a SHA-256 checksum; verify with:

powershell
Get-FileHash GitLineHistory.exe -Algorithm SHA256

Or build it yourself — see Building below.

Usage

pascal
GitLineHistory.exe <full-path-to-file> [line-number]
  • With a line number — runs git blame on that line, selects the commit that last changed it, and opens the diff centred on that line. If the commit arrived through a merge (and is not on the first-parent chain), the merge commit is selected instead.
  • Without a line number (or 0) — opens at the most recent commit and jumps to the first difference.

If the file has uncommitted local changes, a synthetic "Working copy — not committed" entry appears at the top of the history.

pascal
GitLineHistory.exe "C:\repo\src\unit1.pas" 4581
GitLineHistory.exe "C:\repo\src\unit1.pas"

Features

  • Commit history grid — author, date, and the first line of each commit message; hover shows the full message; right-click → Show Comment opens it in a window.
  • Side-by-side diff with ghost-row alignment, whole-line colouring, and word-level highlighting inside modified lines (toggle between word and line mode).
  • Vertical or horizontal split — side-by-side or stacked panels, toggle button.
  • Find Previous / Next Change to This Line — right-click any line in the diff to walk back through that line's history step by step, or forward from an old version to the commit that changed or deleted it.
  • Diff navigation — First/Prev/Next/Last difference buttons, plus a Find dialog (Ctrl+F) and go-to-line (Alt+G).
  • Fast on large files — the commit history appears in about two seconds even for a 50,000-line file with thousands of commits; the diff fills in once git blame has located the commit that last changed the line.
  • Rename tracking — history follows file renames (git log --follow).
  • Linear history — uses --first-parent, so feature-branch noise is hidden; merged changes are visible at the merge commit.
  • Per-language syntax highlighting — chosen from the file extension: Pascal, SQL, XML, HTML, CSS, JS/JSON, Python, C-family, INI, batch, shell and diff/patch. Unrecognised extensions render as plain text.
  • Encoding detection — UTF-8, UTF-16 LE/BE (BOM), and Windows-1251 fallback.
  • Ctrl+mouse-wheel zooms the diff font and the history grid independently.

Building

Requirements: Lazarus with FPC 3.2.2+ (x86_64-win64).

pascal
build_release.bat       (optimised, stripped, ~5 MB)
build_debug.bat         (DWARF debug info, ~40 MB)

The Lazarus directory defaults to c:\lazarus; override it via the LAZDIR environment variable (or set FPC to a specific compiler binary). The scripts run from the project directory, wherever it is cloned.

Opening GitLineHistory.lpi in the Lazarus IDE also works.

License

GitLineHistory is free software, released under the GNU General Public License v3.0 or later — see LICENSE.

It builds on code from other free-software projects:

  • The diff viewer infrastructure (unitprocess.pas, unitdiffmgr.pas, unitdiffchunker.pas, unitdiffmarkup.pas, unitdiffcolors.pas, unitintervals.pas) is adapted from LazGitGui, Copyright (C) 2023 Jesus Reyes Aguilar (GPLv3 project; the unit headers grant GPL-2.0-or-later, used here under the "or later" option).
  • The O(NP) diff algorithm (Diff.pas) is by Angus Johnson (freeware, © 2001–2009).

Authorship

This program was written by Claude (Anthropic's AI assistant) under the guidance of Simeon Bodurov.