Forrest logo
back to the git tool

git-fetch:tldr:53a60

git-fetch: Delete local references to remote branches that have been deleted upstream.
$ git fetch --prune
try on your machine

The command "git fetch --prune" is used to update and synchronize your local git repository with a remote repository. Here's a breakdown of its components:

  • "git fetch" retrieves the latest commits and changes from a remote repository, but does not integrate them into your local branch. It only updates your local copy of the remote repository.

  • "--prune" option tells Git to remove any remote-tracking branches that no longer exist on the remote repository. In other words, it removes references to branches that have been deleted on the remote repository since your last synchronization.

Using "git fetch --prune" is helpful to ensure that your local repository accurately reflects the state of the remote repository by updating your local branch and removing any obsolete references.

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