首页 > 其他 > 详细

git如何删除远端分支

时间:2015-01-22 17:37:12      阅读:248      评论:0      收藏:0      [点我收藏+]

转自:http://elephantliu.blog.51cto.com/1107116/636967

 

曾经纠结于在github.com上开了太多分支导致分支过于混乱。一直在寻找删除远端分支的方法,可是网上搜到的方法都不好用。

   无意间犯的一个错误导致github.com的项目上的一个分支被删除,才发现删除github.com分支的方法。希望能够为大家提供帮助。

   思路:

   新建一个空的版本库,直接把空的版本库push到github.com的某个分支上。这个分支就会被自动删除。

   代码:

  1. remote_repo="https://github.com/lexdene/Dlut-Game-Platform.git" #这是我想删除分支的仓库地址

  2. remote_branch="libapi" #这是我想删除的远端仓库分支的名字

  3. mkdir /tmp/git-empty

  4. cd /tmp/git-empty

  5. git init

  6. git push $remote_repo :$remote_branch #有个冒号不能省略

   全文完。

 

 

# 更新

git branch -d -r $remote_branch

git push remote_name --delete branch_name

 

本文出自 “elephant_liu” 博客,请务必保留此出处http://elephantliu.blog.51cto.com/1107116/636967

git如何删除远端分支

原文:http://www.cnblogs.com/lslzhang/p/4241794.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!