search

Home  >  Q&A  >  body text

What does git branch -rd remote/branch delete?

git branch -rd remote_name/branch_name
After deletion, the prompt is successful.
Use
git branch -r
to get the remote branch list. There is no branch remote_name/branch. _name,
and then use
git pull
to find that branch branch_name was obtained from the remote end,
then what did
git branch -rd remote_name/branch_name
delete?

My git version is given here:
git version
git version 2.7.0.windows.1

仅有的幸福仅有的幸福2811 days ago805

reply all(1)I'll reply

  • 给我你的怀抱

    给我你的怀抱2017-05-02 09:37:31

    git branch -r 操作的是 remote-tracking branch 这个branch依然是你本地的,不过它不能被编辑。
    譬如当你从一个remotefetch时,如果在此之前其他人在remote上提交了一个新的分支somebranch, you may see the following message:

    git fetch origin
    remote: Counting objects: 1, done.
    remote: Compressing objects: 100% (1/1), done.
    remote: Total 1 (delta 0), reused 1 (delta 0)
    Unpacking objects: 100% (1/1), done.
    [new branch]      somebranch    -> origin/somebranch
    

    At this time, you have one more local branchorigin/somebranchThis is a remote-tracking branch, and then you can checkout one from it to do your work:

    git checkout -b sbranch origin/somebranch
    
    

    Remote branches can only be deleted through git push.

    reply
    0
  • Cancelreply