Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use git for software development. I do not use Microsoft OneNote. However, in some contexts OneNote comes up as an option for the right-click menu on things. I accidentally pressed it while trying to do something else with a file that was included in my git repo. I closed out of it, but upon inspecting my git repository, I found it had created a OneNote file in every single directory of my repo.

Furthermore, there is now a git branch labeled OneNote Table Of Contents.onetoc2 Note that there are spaces in the branch name. I was able to delete all of the OneNote files, but I can't get rid of the extra branch.

Is there an alternative means of deleting a branch besides the git branch -d option? I use Windows 7 Home Premium.

share|improve this question

Locally-created branches in Git are simply files inside the .git/refs directory that contain SHA1 hashes of Git commit objects. Therefore, you can remove these branches by deleting the appropriate files.

This particular branch is probably in the .git/refs/heads directory; if so, this command should work from the repository's root:

del ".git\refs\heads\OneNote Table Of Contents.onetoc2"
share|improve this answer

Try using Git Extensions. Since spaces are not allowed in git, I bet those are other characters that you cannot type (it's strange how those sneaked in though). A decent GUI should be able to reproduce branch name for deletion purposes whatever it is.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .