# git checkout -b -f v1.5.5.1

4 messages from 2008-05-05 to 2008-05-05. Participants: Jun Ma, Stephan Beyer, Eric Hanchrow.
Thread: https://gitlist.dev/t/13386

## Jun Ma, 2008-05-05 15:48

Subject: git checkout -b -f v1.5.5.1
Message-ID: <dcf6addc0805050848v91589c6i6c2fca168b7644d5@mail.gmail.com>
URL: https://gitlist.dev/e/dcf6addc0805050848v91589c6i6c2fca168b7644d5%40mail.gmail.com

```
Hi, all
     I just mistaken 'git checkout -b 1.5.5.1 v1.5.5.1' to 'git
checkout -b -f v1.5.5.1', and I don't how to delete it ,

  537  git-branch -D -f
  538  git-branch -D \-f
  539  git-branch -D "\-f"

     all the above operations were failed. :(

     PS: Would it be better if we do checking on branch name to avoid
this case?

-- 
FIXME if it is wrong.

```

## Stephan Beyer, 2008-05-05 15:58

Subject: Re: git checkout -b -f v1.5.5.1
Message-ID: <20080505155830.GC18443@leksak.fem-net>
URL: https://gitlist.dev/e/20080505155830.GC18443%40leksak.fem-net
In-Reply-To: <dcf6addc0805050848v91589c6i6c2fca168b7644d5@mail.gmail.com>

```
Hi,

>      I just mistaken 'git checkout -b 1.5.5.1 v1.5.5.1' to 'git
> checkout -b -f v1.5.5.1', and I don't how to delete it ,

Try
  git branch -D -- -f

>   537  git-branch -D -f
>   538  git-branch -D \-f
>   539  git-branch -D "\-f"
> 
>      all the above operations were failed. :(

In all cases, git-branch gets -f as parameter, because your shell "expands"
them to -f.

> PS: Would it be better if we do checking on branch name to avoid this case?

What do you want to check for?
No leading dashes?

-- 
Stephan Beyer <s-beyer@gmx.net>, PGP 0x6EDDD207FCC5040F

```

## Eric Hanchrow, 2008-05-05 16:03

Subject: Re: git checkout -b -f v1.5.5.1
Message-ID: <87zlr468n9.fsf@offby1.atm01.sea.blarg.net>
URL: https://gitlist.dev/e/87zlr468n9.fsf%40offby1.atm01.sea.blarg.net
In-Reply-To: <dcf6addc0805050848v91589c6i6c2fca168b7644d5@mail.gmail.com>

```

    Hi, all
         I just mistaken 'git checkout -b 1.5.5.1 v1.5.5.1' to 'git
    checkout -b -f v1.5.5.1', and I don't how to delete it ,

      537  git-branch -D -f
      538  git-branch -D \-f
      539  git-branch -D "\-f"

         all the above operations were failed. :(

         PS: Would it be better if we do checking on branch name to avoid
    this case?

You could probably just

    rm .git/refs/heads/-f

and if necessary, replace the content of .git/HEAD with something else.

-- 
FIXME if it is wrong.

-- 

                               _
                              / )
              (\__/)         ( (
              )    (          ) )
            ={      }=       / /
              )     `-------/ /
             (               /
              \             )
             ,'\       ,    ,'
             `-'\  ,---\   | \
                _) )    `. \ /
               (__/       ) )   hjw
                         (_/

```

## Jun Ma, 2008-05-05 16:09

Subject: Re: git checkout -b -f v1.5.5.1
Message-ID: <dcf6addc0805050909r65966e7bmd342c57443fd8c31@mail.gmail.com>
URL: https://gitlist.dev/e/dcf6addc0805050909r65966e7bmd342c57443fd8c31%40mail.gmail.com
In-Reply-To: <20080505155830.GC18443@leksak.fem-net>

```
On Mon, May 5, 2008 at 11:58 PM, Stephan Beyer <s-beyer@gmx.net> wrote:

>  >      I just mistaken 'git checkout -b 1.5.5.1 v1.5.5.1' to 'git
>  > checkout -b -f v1.5.5.1', and I don't how to delete it ,
>
>  Try
>   git branch -D -- -f
>
It works, thanks. :)


>
>  > PS: Would it be better if we do checking on branch name to avoid this case?
>
>  What do you want to check for?
>  No leading dashes?
>
I thought it would be better do this job, so we won't get a
malformed(I thought '-f' is) branch name.:)


-- 
FIXME if it is wrong.

```
