聊下 git remote prune origin

简介:

在你经常使用的命令当中有一个git branch –a 用来查看所有的分支,包括本地和远程的。但是时间长了你会发现有些分支在远程其实早就被删除了,但是在你本地依然可以看见这些被删除的分支。

你可以通过命令,git remote show origin 来查看有关于origin的一些信息,包括分支是否tracking。

1

Local refs configured for ‘git push’,这一栏说明你push了哪些分支上origin。

2

develop_newfeature_apiwrapper,分支在远程,我们现在去把他删除掉。

3

点击垃圾桶,将其删除。再回到本地来查看所有分支。

4

它依然存在。但是你再通过 git remote show origin,来查看就会发现问题。

5

提示你可以通过git remote prune 移除这个分支。(也就是说你可以刷新本地仓库与远程仓库的保持这些改动的同步)

6

这个在远程删除的分支在你本地仓库也将被删除。再通过git branch –a 来查看。

7

已经不存在了。




 本文转自 王清培 51CTO博客,原文链接:http://blog.51cto.com/wangqingpei557/1872261,如需转载请自行联系原作者

相关文章
|
2天前
|
网络安全 开发工具 git
git修改提交路径以及强制提交——异常:error: remote origin already exists.与异常:error: failed to push some refs to的解决
git修改提交路径以及强制提交——异常:error: remote origin already exists.与异常:error: failed to push some refs to的解决
24 0
|
2天前
|
网络安全 数据安全/隐私保护
解决git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Pleas
解决git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Pleas
|
2天前
|
开发工具 git
完美解决git 执行git push origin master指令 报错command not found
完美解决git 执行git push origin master指令 报错command not found
32 0
|
6月前
|
网络安全 开发工具 git
git clone之报错git@gitee.com:Permission denied (publickey).fatal: Could not read from remote repository
git clone之报错git@gitee.com:Permission denied (publickey).fatal: Could not read from remote repository
193 0
|
2天前
|
开发工具 git
Git:error: remote origin already exists
Git:error: remote origin already exists
24 2
|
6月前
|
开发工具 git
git push origin master提交报错解决办法
git push origin master提交报错解决办法
82 0
|
2天前
|
缓存 数据可视化 网络安全
Git命令大全
Git命令大全
61 1
|
2天前
|
开发工具 git
Git教程:深入了解删除分支的命令
【4月更文挑战第3天】
67 0
Git教程:深入了解删除分支的命令
|
2天前
|
存储 Shell Linux
【Shell 命令集合 文件管理】Linux git命令使用教程
【Shell 命令集合 文件管理】Linux git命令使用教程
37 0

相关实验场景

更多