What does 'git fetch -p' means

后端 未结 4 1662
Happy的楠姐
Happy的楠姐 2020-12-29 20:34

I had run this command with misunderstandings while I was deleting my one local branch,

git branch -D branch-name

git fetch -p 

but I have

4条回答
  •  失恋的感觉
    2020-12-29 21:20

    The other answers explain what git fetch --prune does, but there is one case where it needs to be a bit more precise: when the there is nothing to fetch (no new refs) from the upstream repo.
    In that case, it does prune the remote tracking branches (from /remotes/anUpstreamRepo/*), but it didn't say what upstream repo was the cause of said pruning.

    This is fixed by commit 4b3b33a by Tom Miller (tmiller) for git 1.9/2.0 (Q1 2014):

    fetch --prune: always print header url

    If "fetch --prune" is run with no new refs to fetch, but it has refs to prune. Then, the header url is not printed as it would if there were new refs to fetch.

    Output before this patch:

    $ git fetch --prune remote-with-no-new-refs
     x [deleted]         (none)     -> origin/world
    

    Output after this patch:

    $ git fetch --prune remote-with-no-new-refs
    From https://github.com/git/git
     x [deleted]         (none)     -> origin/test
    

提交回复
热议问题