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

Re: Bootstrapping into git, commit gripes at me

From
Linus Torvalds <torvalds@osdl.org>
Date
Jul 12, 2005, 03:49 UTC
Message-ID
<Pine.LNX.4.58.0507112045420.17536@g5.osdl.org>
In-Reply-To
<Pine.LNX.4.58.0507112005540.17536@g5.osdl.org>
On Mon, 11 Jul 2005, Linus Torvalds wrote:
Show 15 quoted lines
> On Mon, 11 Jul 2005, Marc Singer wrote:
> > 
> > From my POV, what I want is a branch with the tag v2.6.12 as the basis
> > of the branch.  I'm guessing that -b means "make me a branch and call
> > it this".
> 
> Yup. That would be the interface.
> 
> >  # git checkout -b BRANCH_NAME [TAG]
> > 
> > If the TAG is omitted, the branch is made from the current HEAD or
> > some other reasonable point defined by the current working directory.
> 
> That would be the most natural thing that would fall out of this kind of 
> interface.
Ok, done. 
Now, if you try to do
	git checkout v2.6.12
git will complain with
	git checkout: you need to specify a new branch name

and some day (when I can get my act together and have man-pages that work), there would even be documentation for the "-b" flag to specify the branch name. And indeed, if you only specify the branch name, it will just create it and switch to it from the current HEAD.

So while there are no docs, the checkin comment hopefully says it all:
		Linus
---
commit 91dcdfd3b5331d955cfb60edf8930f1b5c142905
Author: Linus Torvalds <torvalds@g5.osdl.org>
Date:   Mon Jul 11 20:44:20 2005 -0700
    Make "git checkout" create new branches on demand
    In particular, if we check out something that isn't an old branch, it
    now requires a new branch-name to check the thing out into.
    So, for example:
        git checkout -b my-branch v2.6.12
    will create the new branch "my-branch", and start it at v2.6.12, while
        git checkout master
    will just switch back to the master branch.
    Of course, if you want to create a new branch "my-branch" and _not_
    check it out, you could have done so with just
        git-rev-parse v2.6.12^0 > .git/refs/heads/my-branch
    which I think I will codify as "git branch".
Previous: Linus TorvaldsNext: Linus Torvalds
Message 10 of 33 in “Bootstrapping into git, commit gripes at me”
  1. Marc SingerJul 8, 2005
  2. Linus TorvaldsJul 9, 2005
  3. Marc SingerJul 11, 2005
  4. Junio C HamanoJul 11, 2005
  5. Junio C HamanoJul 11, 2005
  6. Linus TorvaldsJul 12, 2005
  7. Linus TorvaldsJul 12, 2005
  8. Marc SingerJul 12, 2005
  9. Linus TorvaldsJul 12, 2005
  10. Linus TorvaldsJul 12, 2005
  11. Linus TorvaldsJul 12, 2005
  12. Marc SingerJul 12, 2005
  13. Linus TorvaldsJul 12, 2005
  14. Marc SingerJul 12, 2005
  15. Petr BaudisJul 12, 2005
  16. Junio C HamanoJul 12, 2005
  17. Matthias UrlichsJul 12, 2005
  18. Petr BaudisJul 24, 2005
  19. Junio C HamanoJul 24, 2005
  20. Linus TorvaldsJul 12, 2005
  21. Petr BaudisAug 12, 2005
  22. Junio C HamanoJul 12, 2005
  23. Linus TorvaldsJul 12, 2005
  24. Junio C HamanoJul 12, 2005
  25. Linus TorvaldsJul 12, 2005
  26. Marc SingerJul 12, 2005
  27. Daniel BarkalowJul 12, 2005
  28. Linus TorvaldsJul 11, 2005
  29. Marc SingerJul 9, 2005
  30. Matthias UrlichsJul 9, 2005
  31. Petr BaudisJul 10, 2005
  32. Marc SingerJul 9, 2005
  33. Junio C HamanoJul 9, 2005

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.