刪除分支

刪除本地分支git

git branch -D分支名稱rem

刪除遠程分支it

git push origin --delete遠程分支名稱ast

刪除在本地有但在遠程庫中已經不存在的分支class

git remote show origindate

能夠查看遠程庫的一些信息,及與本地分支的信息。有時候可能遇到以下狀況word

$ git remote show origindi

* remote originauth

  Fetch URL: ... .gitco

  Push  URL: ... .git

  HEAD branch: master

  Remote branches:

    dev                    tracked

    jqmobi                  tracked

    master                  tracked

    refs/remotes/origin/3.1 stale(use 'git remote prune' to remove)

    refs/remotes/origin/tc  stale(use 'git remote prune' to remove)

    refs/remotes/origin/xhl stale(use 'git remote prune' to remove)

  Local branches configured for 'git pull':

    dev    merges with remote dev

    master merges with remote master

  Local refs configured for 'git push':

    dev    pushes to dev    (up to date)

    jqmobi pushes to jqmobi(up to date)

    master pushes to master(up to date)

其中3.1, tc, xhl三個分支在遠程庫已經不存在了(你以前從遠程庫拉取過,可能以後被其餘人刪除了,你用 git branch -a 也是不能看出它們是否已被刪除的),這時候咱們能夠刪除本地庫中這些相比較遠程庫中已經不存在的分支:

$ git remote prune origin

Password for '...':

Pruning origin

URL: ... .git

 *[pruned]origin/3.1

 *[pruned]origin/tc

 *[pruned]origin/xhl

相關文章
相關標籤/搜索