LinuxCommandLibrary

git-missing

Find unreachable commits

TLDR

Show commits which aren't shared between the currently checked-out branch and another branch

$ git missing [branch]
copy

Show commits which aren't shared between two branches
$ git missing [branch_1] [branch_2]
copy

SYNOPSIS

git missing [options] [upstream-branch] [local-branch]

PARAMETERS

-h, --help
    Display help message

--version
    Show version information

-r, --remote [name]
    Show only remote-tracking branches

-a, --all
    Include all branches in comparison

-g, --grep=PATTERN
    Filter commits matching the pattern

-s, --summary
    Display summary of missing commits

--no-merges
    Exclude merge commits from output

DESCRIPTION

git-missing is a powerful Git extension designed to identify and display commits present in one branch but absent in another. It provides a clear, graphical representation using git log --graph style output, making it easy to spot divergence between branches like master and feature branches.

This tool is invaluable for developers managing complex workflows, such as preparing hotfixes, syncing release branches, or reviewing pull requests. By default, it compares the current branch against an upstream branch (e.g., origin/master), listing unique commits with details including SHA, author, date, and commit message. Users can filter results to focus on relevant changes.

Unlike git log or git cherry, git-missing offers a concise, branch-focused view without overwhelming output. It's particularly useful before merging to avoid missing critical commits or duplicating work.

Installation is straightforward via RubyGems, and it integrates seamlessly into Git aliases for frequent use.

CAVEATS

Not a core Git command; requires installation (e.g., gem install git-missing). Ruby dependency. Output assumes linear history may mislead in complex graphs.

INSTALLATION

Run gem install git-missing or clone from GitHub: git clone https://github.com/ewr/git-missing.git and add to PATH.

EXAMPLE USAGE

git missing origin/master feature-branch
Lists commits in origin/master missing from feature-branch.
git missing -r -s
Summary of remote missing commits.

HISTORY

Developed by Eron Wright around 2010 as a Ruby script. Released as a gem for easy distribution. Gained popularity for simplifying branch comparisons in Git workflows.

SEE ALSO

Copied to clipboard