搜尋

首頁  >  問答  >  主體

git branch -rd remote/branch刪除的是什麼?

git branch -rd remote_name/branch_name
刪除後提示成功,
使用
git branch -r
得到遠端分支列表,沒有了分支remote_name/branch -r

得到遠端分支列表,沒有了分支remote_name/branch -r得到遠端分支列表,沒有了分支remote_name/branch_name,gitbranch遠端獲得了分支branch_name,


git branch -rd remote_name/branch_name刪除的是什麼?

這裡給我的git版本:


git versiongit version 2.7.0.windows.1

仅有的幸福仅有的幸福2875 天前838

全部回覆(1)我來回復

  • 给我你的怀抱

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

    git branch -r 操作的是 remote-tracking branch 这个branch依然是你本地的,不过它不能被编辑。
    譬如当你从一个remotefetch时,如果在此之前其他人在remote上提交了一个新的分支somebranch,你可能會看到以下的資訊:

    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
    

    此時你本地多了一個origin/somebranch這個就是一個remote-tracking branch, 然後你可以從中checkout一個出來做你的事情:

    git checkout -b sbranch origin/somebranch
    
    

    刪除遠端分支只能透過git push的方式。

    回覆
    0
  • 取消回覆