Skip to main content

prune_fetch

Function prune_fetch 

Source
pub fn prune_fetch(repo: &Repository, remote_name: &str) -> Result<()>
Expand description

Prune-fetch from a single remote: remove stale remote-tracking refs, then fetch.

Equivalent to git fetch --prune <remote>. After this call, any refs/remotes/<remote>/<branch> ref that no longer exists on the remote is deleted locally, making Branch::upstream() correctly return Err (i.e. “gone”) for branches that were deleted upstream.

Returns Err on auth failure, network error, or unknown remote. Callers that want warn-and-continue behaviour should catch the error and proceed without aborting the rest of the prune.