git remote prune origin
Remove stale remote-tracking branches.
This command deletes remote-tracking branches that no longer exist on the remote repository named origin
.
It helps clean up outdated branches that have been removed from the remote repository, ensuring your local repository stays in sync with the remote.
Variations include using git remote prune <remote_name>
to target a different remote, or git remote prune -n origin
for a dry-run to see what would be pruned without actually removing anything.