What is Git pruning? What is Git pruning? git git

What is Git pruning?


"Prune remote branches" in Git Extensions executes git remote prune command, which removes your local remote tracking branches where the branch no longer exists on the remote.

See here: https://git-scm.com/docs/git-remote#Documentation/git-remote.txt-empruneem


This just garbage collects your branches.

Thats means, if an object (a commit) cannot be reached in any of your branch's ancestors, it will be removed for the git database, and as such couldn't be reach anymore.

This just cleans up a little the git repository and make it lighter.


It's important to know that prune is repo-bound. Not everyone knows that you can link your local repo to multiple remotes. It comes in handy when, for example, you work with an open-source project and is enforced to work via forks.

So, prune command requires a repo name. In most cases it's git remote prune origin, but you can call your repo anything, it doesn't have to be origin.