Forrest logo
back to the git tool

git-prune:tldr:a61df

git-prune: Prune unreachable objects and display what has been pruned to `stdout`.
$ git prune --verbose
try on your machine

The git prune --verbose command is used to remove the unreachable objects from a Git repository and provides a detailed output of the pruning process.

In Git, unreachable objects are the ones that are no longer reachable from any branch or commit in your repository's history. These can include commits, trees, and blobs that are unreferenced or with expired references.

When you run git prune, Git scans the repository to find and remove these unreferenced objects, freeing up disk space and optimizing the repository's performance. Adding the --verbose option to the command makes Git display a detailed output, showing each object being pruned and providing information about it.

The output generated by git prune --verbose typically includes information such as the object's type (commit, tree, or blob), its SHA-1 hash, and the reason it was pruned (e.g., unreachable, expired reference).

It is important to note that the pruning process permanently removes the unreferenced objects. Exercise caution while using this command because if an object was removed accidentally, it might not be recoverable.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the git tool