git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Cannot delete weirdly named branch
       [not found] <CAGhmpEFg2ZcwqO=wDNPLfPCnrobq4oOcwvFCm27vrEuiES2XbQ@mail.gmail.com>
@ 2012-07-23 18:32 ` abhisekpan
  2012-07-23 18:42   ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: abhisekpan @ 2012-07-23 18:32 UTC (permalink / raw)
  To: git

Hi,

I am a new user to git and I found an interesting behavior in git. I
am not sure if this is a bug, but I thought I would report this
anyway!

So I can create a local branch called "--tracking" like this:
git checkout -b --tracking origin/somebranch
I messed up the syntax while trying to create a tracking branch, but
this resulted in a local branch called "--tracking".

Now I cannot delete this branch. Running:
git branch -d --tracking
gives an error: unknown option `tracking'

Using quotes around the name does not help. Is there another command I
can use to delete this branch?

Thank you!
--
Abhisek
Live Long and Prosper

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Cannot delete weirdly named branch
  2012-07-23 18:32 ` Cannot delete weirdly named branch abhisekpan
@ 2012-07-23 18:42   ` Junio C Hamano
  2012-07-30 17:22     ` Michael Haggerty
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2012-07-23 18:42 UTC (permalink / raw)
  To: abhisekpan@gmail.com; +Cc: git

"abhisekpan@gmail.com" <abhisekpan@gmail.com> writes:

> Now I cannot delete this branch. Running:
> git branch -d --tracking
> gives an error: unknown option `tracking'

I do not think this is supposed to work, but it does by accident.

    $ git branch -d -- --tracking
    Deleted branch --tracking (was 8670e20).

A more recent git would not let you create such a branch to begin
with. Perhaps time to upgrade?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Cannot delete weirdly named branch
  2012-07-23 18:42   ` Junio C Hamano
@ 2012-07-30 17:22     ` Michael Haggerty
  2012-07-30 17:55       ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Haggerty @ 2012-07-30 17:22 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: abhisekpan@gmail.com, git

On 07/23/2012 08:42 PM, Junio C Hamano wrote:
> "abhisekpan@gmail.com" <abhisekpan@gmail.com> writes:
>
>> Now I cannot delete this branch. Running:
>> git branch -d --tracking
>> gives an error: unknown option `tracking'
>
> I do not think this is supposed to work, but it does by accident.
>
>      $ git branch -d -- --tracking
>      Deleted branch --tracking (was 8670e20).

The plumbing command "git update-ref -d refs/heads/--tracking" can also 
be used to delete such a branch.

Michael

-- 
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Cannot delete weirdly named branch
  2012-07-30 17:22     ` Michael Haggerty
@ 2012-07-30 17:55       ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2012-07-30 17:55 UTC (permalink / raw)
  To: Michael Haggerty; +Cc: abhisekpan@gmail.com, git

Michael Haggerty <mhagger@alum.mit.edu> writes:

> On 07/23/2012 08:42 PM, Junio C Hamano wrote:
>> "abhisekpan@gmail.com" <abhisekpan@gmail.com> writes:
>>
>>> Now I cannot delete this branch. Running:
>>> git branch -d --tracking
>>> gives an error: unknown option `tracking'
>>
>> I do not think this is supposed to work, but it does by accident.
>>
>>      $ git branch -d -- --tracking
>>      Deleted branch --tracking (was 8670e20).
>
> The plumbing command "git update-ref -d refs/heads/--tracking" can
> also be used to delete such a branch.

Note that once you started using the plumbing you are assumed to
know what you are doing.  "update-ref -d" does not offer the "you
will be losing these commits" safety, and it will not remove
configuration items for "branch.--tracking.*" keys.  You would want
to remove them yourself if you want to emulate "git branch -d".

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-07-30 17:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CAGhmpEFg2ZcwqO=wDNPLfPCnrobq4oOcwvFCm27vrEuiES2XbQ@mail.gmail.com>
2012-07-23 18:32 ` Cannot delete weirdly named branch abhisekpan
2012-07-23 18:42   ` Junio C Hamano
2012-07-30 17:22     ` Michael Haggerty
2012-07-30 17:55       ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).