背景现象

在gitlab上创建了一个分支。直接在gitlab上删除了。但是在本地使用git branch -r 命令的时候,还是能够看到那个分支。
git中如何彻底删除某个分支 git remote prune origin命令

  • 如何去除这个分支记录呢?

git 常用命令科普

1、git branch
显示所有的本地分支。

2、git branch -r
显示所有的远程分支

3、git branch -a
显示所有的分支,远程分支和本地分支

4、git branch newbranch
创建新的分支,但是不切换过去

5、git checkout branchname
分支切换,切换到分支branchname 上去

6、git checkout -b branchname
创建新的分支branchname,并且切换过去

7、git branch -D branchname 删除本地分支 (D 强制)

8、git branch -d -r branchname 删除远端分支

回到上面的那个问题.

在本地使用命令:
git remote show origin

git中如何彻底删除某个分支 git remote prune origin命令

其中 tracked 状态的只有 dev-1.0.0 分支 和 master 分支。
(use ‘git remote prune’ to remove )的分支 V2018-1-11-bugfix 已经在gitlab删除的分支。

所以尝试使用 git remote prune origin 命令:

再执行 git branch -r

git中如何彻底删除某个分支 git remote prune origin命令

V2018-1-11-bugfix 分支已经不存在了。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-09
  • 2022-12-23
  • 2022-12-23
  • 2021-11-14
  • 2021-07-25
猜你喜欢
  • 2022-12-23
  • 2021-10-17
  • 2022-12-23
  • 2021-11-25
  • 2022-12-23
  • 2021-12-17
相关资源
相似解决方案