Cyrus Cyrus - 1 month ago 7
Git Question

How to delete a Git conflict branch

I get the following output when I do:

git branch
somebranch
anotherbranch
* master
master - myemail@mydomain.com's conflict 09.04.2016_15.02.31


So what is that conflict branch at the end? I don't know how how to check it out, how to see what is in it and how to delete it (which is ultimately what I want to do).

P.S. This occurred a while ago, I cant remember how now. I left it but it has been bothering me so I want to fix it now.

Update:Torek's answer helped me. I could not find the file
.git/packed-refs
. I did find the directory
.git/refs/heads
and deleted the unwanted file/branch in there. That seems to have fixed it.

re: The cause, the editor I am using is Atom (from github) and I have installed a package to do git commands from editor. I think that package probably created that conflict branch.

Answer

Space is not a legal character in a Git branch name.

This means that if Git itself made that branch, you have found a bug in Git. (Congratulations!) More likely, though, a badly behaved program that thought it knew better than Git, sneaked behind Git's back and created that branch ... and since space is not a legal character in a Git branch, you may have to sneak behind Git's back again to delete it.

To do that, use a text editor that won't insert BOMs (byte order marks), nor convert plain-text files to Unicode, to edit .git/packed-refs. If there is a line in there with the bogus branch name, delete that line (or modify the name to something more suitable), and write the file. Exit the editor when done. Then, check for a file in .git/refs/heads with that name (including the embedded blanks): if it exists, remove it (or rename it to something more suitable).

The bogus branch name must exist in at least one, and maybe both, places, otherwise Git won't find it as a branch name.

You may also have a file in .git/logs/refs/heads/ with the same bogus name. If so, that file should get the same treatment (remove or rename).

(Note that the .git directory appears in the top level of your work-tree. git rev-parse --git-dir will show the path to it, even if you are in a subdirectory.)