After git deletes the branch remotely, the local git branch-a can still see the workaround.

Source: Internet
Author: User

Use the git branch-a command to view all local and remote branches (git branch-r can view only remote branches)
Found that many of the branches that have been deleted in the remote repository are still visible locally.

$ git branch-a

  movtop
  task_develop
* Weibo
  remotes/origin/head-Origin/task_develop
  Remotes/origin/develop
  remotes/origin/fix_composer_repositories_type
  remotes/origin/join_weixin_module
  remotes/origin/master
  remotes/origin/mining-backup
  remotes/origin/movtop
  remotes/origin/ Right
  remotes/origin/schedule_dev
  remotes/origin/stuff_web_fix
  remotes/origin/task_develop
  Remotes/origin/task_idea
  remotes/origin/task_temp
  remotes/origin/task_yqj
  remotes/origin/ Weibo
  Remotes/origin/weixin_temp

Using the command git remote show origin, you can see the remote address, the remoting branch, and the corresponding relationship between the local branch and other information.

$ git Remote Show origin * Remote Origin Fetch url:https://xxx@gitlab.com/xxx/xxx.git Push Url:https://xxx@gitla B.com/xxx/xxx.git HEAD branch:task_develop Remote branches:master TR                        acked Mining-backup tracked Refs/remotes/origin/develop Stale (use ' git remote prune ' to remove) refs/remotes/origin/fix_composer_repositories_type stale (use ' Git remote p Rune ' to remove] refs/remotes/origin/join_weixin_module stale (use ' git remote prune ' to remove) refs/                          Remotes/origin/movtop stale (use ' git remote prune ' to remove) refs/remotes/origin/right Stale (use ' git remote prune ' to remove) Refs/remotes/origin/schedule_dev stale  (use ' Git remote prune ' to remove) refs/remotes/origin/stuff_web_fix stale (use ' git remote prune ' to Remove) Refs/remoteS/origin/task_temp stale (use ' git remote prune ' to remove) Refs/remotes/origin/weibo
    Stale (use ' git remote prune ' to remove) Task_develop tracked
    Task_idea tracked Task_yqj tracked       Weixin_temp tracked Local branches configured for ' git pull ': movtop Merges with remote Movtop task_develop merges with remote Task_develop Weibo merges with remote Weibo L Ocal ref configured for ' git push ': Task_develop pushes to task_develop (up to date)

At this point we can see those branches that the remote repository does not already exist, and, as prompted, use the Git Remote Prune origin command:

$ git remote prune origin

pruning Origin
url:https://xxx@gitlab.com/xxx/xxx.git
 * [pruned] Origin/develop
 * [pruned] origin/fix_composer_repositories_type
 * [pruned] origin/join_weixin_module
 * [pruned] Origin /movtop
 * [pruned] origin/right
 * [pruned] origin/schedule_dev
 * [pruned] origin/stuff_web_fix
 * [ Pruned] origin/task_temp
 * [pruned] Origin/weibo

This removes the branches that do not exist in the remote repository.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.