What is Git pruning?

Viewed 114651

I've accidentally pruned some remote branches and I don't really know what the consequence of this is (I clicked the "Prune remote branches" button in Git Extensions, thinking it would delete a remote branch).

The official documentation says "git-prune - Prune all unreachable objects from the object database ". I don't really understand what this means. I'm guessing this might have removed merged branches but I'm not really sure.

4 Answers

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.

Related