Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.