How can I delete (or merge) a local Git branch that I'm currently on? How can I delete (or merge) a local Git branch that I'm currently on? git git

How can I delete (or merge) a local Git branch that I'm currently on?


Checkout a different branch first, before deleting it:

git checkout mastergit branch -d MyMods

Also, branches have nothing to do with folders. Git always tracks the whole repository at once, with all its folders and files. A branch is nothing else than a pointer to a single commit, or snapshot, in the history of the repository.


Yes just checkout another branch(maybe master) and then:

git checkout mastergit branch -d thebran


But in my local repository, those branches are still showing up (even though they show up as having no changes).

Branches will show up in your local repo unless you delete them. They don't disappear when you push them.

The answers above tell you how to delete a branch. However, I would add that using the -D option is a bit more powerful. This option deletes the branch regardless of its (un)merged status:

git branch -D branchName

It's the atomic bomb of branch deletion. Use with care.