prune
Prune all unreachable objects from the object database
You probably don’t need this command.
From the help:
In most cases, users should run
git gc
, which callsgit prune
.
If you want to know hw clean-up refereces to remote-tracking branches, see the [Prune Branches](/dev-cheatsheets/cheatsheets/version-control/git/prune-braches.html page.
Tutorial
See git prune tutorial in the Atlassian docs.
The git prune command is an internal housekeeping utility that cleans up unreachable or “orphaned” Git objects.
Unreachable objects are those that are inaccessible by any refs.
Any commit that cannot be accessed through a branch or tag is considered unreachable. git prune is generally not executed directly. Prune is considered a garbage collection command and is a child command of the
git gc
command.
The
git prune
command is intended to be invoked as a child command togit gc
. It is highly unlikely you will ever need to invokegit prune
in a day to day software engineering capacity. Other commands are needed to understand the effects ofgit prune
.
Commands
git prune --dry-run --verbose
git prune --dry-run --verbose --expire=now
Help
git prune [-n] [-v] [--progress] [--expire <time>] [--] [<head>...]