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 [remote [branch]]

PARAMETERS

remote
    The name of the remote repository to compare against. If omitted, defaults to the upstream remote of the current branch (e.g., origin).

branch
    The local branch to check for missing commits. If omitted, defaults to the current active branch (HEAD).

DESCRIPTION

git-missing is a utility, commonly provided by the git-extras package, that helps identify commits present in one Git reference (typically a local branch) but absent from another (often its remote tracking branch). It's particularly useful for determining which commits need to be pushed to a remote repository. By comparing two points in history, it provides a concise list of commits that are 'missing' from the target reference, simplifying complex git log commands often used for comparing divergenced histories.

CAVEATS

git-missing is not a standard Git command bundled with Git itself. It's typically provided by third-party packages like git-extras. Its availability and exact behavior can vary depending on the installed version or custom scripts. It primarily shows commits that are local but not remote (i.e., commits to push). To see commits that are remote but not local (i.e., commits to pull), other commands like git log ..@{upstream} or git-unpulled (from git-extras) are more appropriate.

COMPARISON LOGIC

git-missing typically compares the specified local branch (or current branch) against its remote tracking branch (e.g., HEAD vs. @{upstream}). It identifies commits reachable from the local reference but not from the remote reference. This helps in quickly seeing what work is still pending to be synchronized with the remote.

OUTPUT

The output of git-missing usually mimics git log --oneline, showing commit hashes and subject lines. This concise format makes it easy to quickly review which commits are yet to be pushed or are unique to the local branch.

HISTORY

git-missing emerged as a practical utility script, often part of community-contributed collections like git-extras, to simplify common Git comparison tasks. Before such scripts, users would frequently rely on complex git log invocations (e.g., git log @{upstream}..HEAD --oneline) to achieve the same result. Its development reflects the community's desire for more user-friendly aliases and wrappers for everyday Git operations, abstracting away the intricacies of direct git log arguments for specific comparison scenarios.

SEE ALSO

git-log(1), git-diff(1), git-remote(1), git-branch(1), git-push(1), git-pull(1), git-unpushed(1), git-unpulled(1)

Copied to clipboard