{"thread":{"id":"31076","subject":"Cannot delete weirdly named branch","startedAt":"2012-07-23T18:32:48Z","lastAt":"2012-07-30T17:55:20Z","messageCount":4,"participants":["abhisekpan@gmail.com","Junio C Hamano","Michael Haggerty"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"195544","messageId":"CAGhmpEGEZchXc4DqZ21BAKxf6_mHRp=TOUH8s=GG0vPscz1kfg@mail.gmail.com","threadId":"31076","inReplyTo":"CAGhmpEFg2ZcwqO=wDNPLfPCnrobq4oOcwvFCm27vrEuiES2XbQ@mail.gmail.com","subject":"Cannot delete weirdly named branch","fromName":"abhisekpan@gmail.com","fromEmail":"abhisekpan@gmail.com","sentAt":"2012-07-23T18:32:48Z","receivedAt":"2012-07-23T18:32:48Z","isPatch":false,"sender":{"key":"abhisekpan@gmail.com","avatar":null},"body":"Hi,\n\nI am a new user to git and I found an interesting behavior in git. I\nam not sure if this is a bug, but I thought I would report this\nanyway!\n\nSo I can create a local branch called \"--tracking\" like this:\ngit checkout -b --tracking origin/somebranch\nI messed up the syntax while trying to create a tracking branch, but\nthis resulted in a local branch called \"--tracking\".\n\nNow I cannot delete this branch. Running:\ngit branch -d --tracking\ngives an error: unknown option `tracking'\n\nUsing quotes around the name does not help. Is there another command I\ncan use to delete this branch?\n\nThank you!\n--\nAbhisek\nLive Long and Prosper\n"},{"id":"195547","messageId":"7vsjcil3o5.fsf@alter.siamese.dyndns.org","threadId":"31076","inReplyTo":"CAGhmpEGEZchXc4DqZ21BAKxf6_mHRp=TOUH8s=GG0vPscz1kfg@mail.gmail.com","subject":"Re: Cannot delete weirdly named branch","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-07-23T18:42:50Z","receivedAt":"2012-07-23T18:42:50Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"abhisekpan@gmail.com\" <abhisekpan@gmail.com> writes:\n\n> Now I cannot delete this branch. Running:\n> git branch -d --tracking\n> gives an error: unknown option `tracking'\n\nI do not think this is supposed to work, but it does by accident.\n\n    $ git branch -d -- --tracking\n    Deleted branch --tracking (was 8670e20).\n\nA more recent git would not let you create such a branch to begin\nwith. Perhaps time to upgrade?\n"},{"id":"196168","messageId":"5016C2C9.5050904@alum.mit.edu","threadId":"31076","inReplyTo":"7vsjcil3o5.fsf@alter.siamese.dyndns.org","subject":"Re: Cannot delete weirdly named branch","fromName":"Michael Haggerty","fromEmail":"mhagger@alum.mit.edu","sentAt":"2012-07-30T17:22:17Z","receivedAt":"2012-07-30T17:22:17Z","isPatch":false,"sender":{"key":"mhagger@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/119718?v=4"},"body":"On 07/23/2012 08:42 PM, Junio C Hamano wrote:\n> \"abhisekpan@gmail.com\" <abhisekpan@gmail.com> writes:\n>\n>> Now I cannot delete this branch. Running:\n>> git branch -d --tracking\n>> gives an error: unknown option `tracking'\n>\n> I do not think this is supposed to work, but it does by accident.\n>\n>      $ git branch -d -- --tracking\n>      Deleted branch --tracking (was 8670e20).\n\nThe plumbing command \"git update-ref -d refs/heads/--tracking\" can also \nbe used to delete such a branch.\n\nMichael\n\n-- \nMichael Haggerty\nmhagger@alum.mit.edu\nhttp://softwareswirl.blogspot.com/\n"},{"id":"196177","messageId":"7vk3xlqgl3.fsf@alter.siamese.dyndns.org","threadId":"31076","inReplyTo":"5016C2C9.5050904@alum.mit.edu","subject":"Re: Cannot delete weirdly named branch","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-07-30T17:55:20Z","receivedAt":"2012-07-30T17:55:20Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael Haggerty <mhagger@alum.mit.edu> writes:\n\n> On 07/23/2012 08:42 PM, Junio C Hamano wrote:\n>> \"abhisekpan@gmail.com\" <abhisekpan@gmail.com> writes:\n>>\n>>> Now I cannot delete this branch. Running:\n>>> git branch -d --tracking\n>>> gives an error: unknown option `tracking'\n>>\n>> I do not think this is supposed to work, but it does by accident.\n>>\n>>      $ git branch -d -- --tracking\n>>      Deleted branch --tracking (was 8670e20).\n>\n> The plumbing command \"git update-ref -d refs/heads/--tracking\" can\n> also be used to delete such a branch.\n\nNote that once you started using the plumbing you are assumed to\nknow what you are doing.  \"update-ref -d\" does not offer the \"you\nwill be losing these commits\" safety, and it will not remove\nconfiguration items for \"branch.--tracking.*\" keys.  You would want\nto remove them yourself if you want to emulate \"git branch -d\".\n"}]}