5: Deleting Branches(Git branches)

A good way to think of a branch is as a collection of commits. Here's an example:

masterenhancementf34f34bot.pybot.pyprint(1)print(1)b53b53bot.pybot.pyprint(2)print(2)

In the above example, both master andenhancement have the commit b53 as the latest commit. Both branches have identical commits. This isn't necessarily bad, but it does mean that the original branch is redundant -- it no longer contains any unique commits. It's typical to use a branch to develop a single feature, merge than branch into master, then delete that branch.

It's possible to delete branches once all of the commits in them have been merged into another branch. This can be done via the git branch -dcommand. git branch -d requires you to specify the name of a branch when you call it.

The branch will be removed completely from your local repo. If a branch has unmerged commits inside it, git will prevent it from being deleted, so its generally safe to delete branches that you think are old or unnecessary.

Having too many branches can make the repo hard to use, so most software teams tend to delete branches once they've been merged. For example, if you have many branches, listing all the branches in a repo can print hundreds or thousands of lines, making it hard to find the branches you want. It also makes cloning or updating the repo more difficult, because git needs to download information on all of the branches.

Instructions

  • Delete the more-speech branch.

~$ cd /home/dq/chatbot

~$ git branch -d more-speech

转载于:https://my.oschina.net/RobertPattins/blog/746979

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值