What are the differences between git remote prune, git prune, git fetch --prune, etc

前端 未结 4 1984
野趣味
野趣味 2020-11-27 09:06

My situation is this... someone working on the same repo has deleted a branch from his local & remote repo...

Most people who have asked about this kind of probl

4条回答
  •  一生所求
    2020-11-27 09:19

    Note that one difference between git remote --prune and git fetch --prune is being fixed, with commit 10a6cc8, by Tom Miller (tmiller) (for git 1.9/2.0, Q1 2014):

    When we have a remote-tracking branch named "frotz/nitfol" from a previous fetch, and the upstream now has a branch named "**frotz"**, fetch would fail to remove "frotz/nitfol" with a "git fetch --prune" from the upstream.
    git would inform the user to use "git remote prune" to fix the problem.

    So: when a upstream repo has a branch ("frotz") with the same name as a branch hierarchy ("frotz/xxx", a possible branch naming convention), git remote --prune was succeeding (in cleaning up the remote tracking branch from your repo), but git fetch --prune was failing.

    Not anymore:

    Change the way "fetch --prune" works by moving the pruning operation before the fetching operation.
    This way, instead of warning the user of a conflict, it automatically fixes it.

提交回复
热议问题