What does the git fetch --prune command do?

What does the git fetch --prune command do?

a) Removes references to branches that no longer exist on the remote
b) Deletes all branches on the remote
c) Fetches all branches from the remote
d) Updates the current branch to match the remote

Answer:

a) Removes references to branches that no longer exist on the remote

Explanation:

The git fetch --prune command removes local references to remote branches that have been deleted from the remote repository. It ensures that your local representation of the remote branches is up-to-date and free of stale references.

This command is useful for cleaning up local branches that no longer exist on the remote and maintaining a clean repository.

Using git fetch --prune regularly ensures that your local repository reflects the state of the remote repository accurately.

Reference:

Top 100 Git and GitHub MCQ Questions and Answers

Scroll to Top