Forrest logo
back to the git tool

git-prune:tldr:27167

git-prune: Prune unreachable objects while showing progress.
$ git prune --progress
try on your machine

The command "git prune --progress" is used in Git to remove unreachable objects from the repository.

When you perform various operations in Git, such as creating new branches or tags, objects (commits, trees, and blobs) are created and stored in the repository. Over time, as you continue working with Git, some of these objects may become unreachable or unreferenced. This can happen if you delete a branch or tag, or if you perform operations that rewrite the commit history.

The "git prune" command allows you to remove these unreferenced objects from the repository, reclaiming disk space and improving performance. The "--progress" option is used to show progress information during the pruning process.

When you run "git prune --progress", Git scans the entire repository and identifies objects that are no longer reachable. It then removes these objects from the repository, freeing up space. The "--progress" option provides continuous feedback on the progress of the pruning operation, displaying which objects are being pruned.

It's important to note that "git prune" only removes unreferenced objects that are not reachable from any branch or tag. Objects that are still reachable, even if they are not directly referenced by a branch or tag, will not be removed.

Overall, the "git prune --progress" command is a useful tool for cleaning up your Git repository and optimizing its storage.

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