git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git checkout multiple options issue

From
Kevin Daudt <me@ikke.info>
Date
Jan 28, 2019, 16:55 UTC
Message-ID
<20190128165515.GA25995@alpha>
In-Reply-To
<000701d4b71c$f3ba57f0$db2f07d0$@nexbridge.com>
On Mon, Jan 28, 2019 at 10:20:02AM -0500, Randall S. Becker wrote:
Show 32 quoted lines
> On January 28, 2019 9:25, COLLOMB Joris wrote:
> > -----Message d'origine-----
> >> De : Randall S. Becker <rsbecker@nexbridge.com> Envoyé : lundi 28 janvier
> >> 2019 15:12 À : COLLOMB Joris -EXT <joris.collomb-ext@alstomgroup.com>;
> >> git@vger.kernel.org Objet : RE: Git checkout multiple options issue
> >> 
> >> On January 28, 2019 8:25, COLLOMB Joris wrote:
> >> > git checkout -fb "branch_name"
> >> > (force branch creation and checkout it)
> >> >
> >> > doesn't work (even if option a separated).
> >> >
> >> > I don't know if this is consider as an issue, but here it is.
> >> 
> >> I think you might mean (which works on every platform I have):
> >> 
> >> git checkout -f -b "branch_name"
> >> 
> >> There is no provision for aggregating options into one. -fb (invalid) is
> not the
> >> same as -f -b (valid).
> 
> > git checkout -f -b "branch_name"
> > gives me " Fatal: A branch named 'branch_name' already exists."
> 
> Once the branch is created, you can't force its creation, because it is
> already created. Just
> 
> git checkout "branch_name"
> 
> is sufficient at this point. git is correct to complain that you are trying
> to create a branch that already exists.

git checkout -B exists, which does exactly that: force create a branch at a new positon if it already exists.

Kind regards, Kevin
Previous: Randall S. BeckerNext: Junio C Hamano
Message 5 of 8 in “Git checkout multiple options issue”
  1. COLLOMB Joris -EXTJan 28, 2019
  2. Randall S. BeckerJan 28, 2019
  3. COLLOMB Joris -EXTJan 28, 2019
  4. Randall S. BeckerJan 28, 2019
  5. Kevin DaudtJan 28, 2019
  6. Junio C HamanoJan 28, 2019
  7. COLLOMB Joris -EXTJan 28, 2019
  8. Randall S. BeckerJan 28, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.