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 -d
command. 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