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

Re: What's in git.git (stable)

From
Junio C Hamano <junkio@cox.net>
Date
Dec 14, 2006, 23:46 UTC
Message-ID
<7vk60uyrau.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<200612142255.33564.andyparkins@gmail.com>
Andy Parkins <andyparkins@gmail.com> writes:
Show 7 quoted lines
> On Thursday 2006, December 14 21:22, Junio C Hamano wrote:
>
>> This is interesting.  You said "commit -b", were pointed out
>> that you were talking about "checkout -b", and just after saying
>> "yup, that is right, I was", you again say "commit -b".
>
> There truly is something wrong with me.

I did not mean it that way. I only took it as a sign that maybe "first create and switch to a branch and then work and commit there, in separate steps", which is how git encourages things to be done, does not match people's mental model so well.

> I'm not sure about your "commit -b"; is it wise to have /another/ way of 
> making a branch?  I mean - I'm clearly confused enough, have a heart :-)

I said "commit -b <newbranch>" and deliberately avoided saying "commit -b <anybranch>", because I did not want to open another can of worms while we are discussing so many good things already, and my head can hold only a handful topics at once.

But people on the list (and #git channel) sometimes wished an easy way to help the following workflow.

 * I am in the middle of working on a new feature.  As a good
   git user, I am on a topic branch dedicated for that purpose.
 * While working on it, I find an obvious bug that I would not
   want to fix on the branch (the topic branch I am currently on
   is not about fixing that bug).
 * But I fix it in the working tree anyway, because otherwise I
   would forget.  It happens to be in an isolated file that my
   current topic does not need to modify (say, I was looking at
   a function in that file that my new feature needs to call and
   I wanted to study its calling convention. And I found a typo in
   the comment near the function).
 * The fix does not belong to the current topic, but can go to
   the 'master' branch straight.  It's a fix in the comment that
   cannot possibly break things, and I can/will test it later
   anyway.
 * So with the existing set of tools, I would go there, commit
   and then come back:
	$ git checkout [-m] master
        $ git commit -m 'fix typo in that-file' that-file
        $ git checkout [-m] topic
   But it might be faster to say:
   	$ git commit -b master -m 'fix typo in that-file' that-file
   to make a commit on the other branch and come back
   immediately afterwards.
 * In the same situation, when the 'master' is closed for some
   administrative reason (e.g. "deep freeze before a release and
   strict bugfixes and nothing else are allowed"), I would create
   a new 'typofix' branch and do the same.  I can rebase it
   later on 'master' when it reopens.
	$ git commit -b typofix -m 'fix typo in that-file' that-file
	... much later when master reopens ...
        $ git rebase --onto master topic typofix

It's just a possible typesaver, but I am likely not using it myself (my fingers are already trained to do the three command sequence dance).

I do agree that it adds one more way to do the same thing and would make the documentation noisier, potentially adding more to the confusion. So let's not go there.

Previous: Andy ParkinsNext: Andy Parkins
Message 64 of 102 in “What's in git.git (stable)”
  1. Junio C HamanoDec 13, 2006
  2. Andy ParkinsDec 13, 2006
  3. Jakub NarebskiDec 13, 2006
  4. Andy ParkinsDec 14, 2006
  5. Shawn PearceDec 14, 2006
  6. Andy ParkinsDec 14, 2006
  7. Nicolas PitreDec 14, 2006
  8. Jakub NarebskiDec 15, 2006
  9. Junio C HamanoDec 13, 2006
  10. Peter BaumannDec 13, 2006
  11. Johannes SchindelinDec 14, 2006
  12. Nicolas PitreDec 14, 2006
  13. Junio C HamanoDec 14, 2006
  14. git-show, was Re: What's in git.git (stable)Johannes Schindelin, Dec 14, 2006
  15. Junio C HamanoDec 14, 2006
  16. Johannes SchindelinDec 14, 2006
  17. Andreas EricssonDec 14, 2006
  18. Jakub NarebskiDec 15, 2006
  19. Andy ParkinsDec 14, 2006
  20. Junio C HamanoDec 14, 2006
  21. Andy ParkinsDec 14, 2006
  22. Shawn PearceDec 14, 2006
  23. Carl WorthDec 14, 2006
  24. Shawn PearceDec 14, 2006
  25. reflog by default?, was Re: What's in git.git (stable)Johannes Schindelin, Dec 14, 2006
  26. Nicolas PitreDec 14, 2006
  27. Junio C HamanoDec 14, 2006
  28. Shawn PearceDec 14, 2006
  29. Nicolas PitreDec 14, 2006
  30. Andreas EricssonDec 14, 2006
  31. Junio C HamanoDec 15, 2006
  32. Shawn PearceDec 16, 2006
  33. Nicolas PitreDec 14, 2006
  34. Junio C HamanoDec 14, 2006
  35. Enable reflogs by default in all repositories.Shawn O. Pearce, Dec 14, 2006
  36. Nicolas PitreDec 14, 2006
  37. Junio C HamanoDec 14, 2006
  38. Andy ParkinsDec 14, 2006
  39. Jakub NarebskiDec 15, 2006
  40. Jakub NarebskiDec 15, 2006
  41. Nicolas PitreDec 15, 2006
  42. Andreas EricssonDec 15, 2006
  43. Nicolas PitreDec 15, 2006
  44. Shawn PearceDec 15, 2006
  45. Andreas EricssonDec 15, 2006
  46. Johannes SchindelinDec 15, 2006
  47. Nicolas PitreDec 15, 2006
  48. make commit message a little more consistent and confortingNicolas Pitre, Dec 15, 2006
  49. Shawn PearceDec 15, 2006
  50. Andreas EricssonDec 15, 2006
  51. Shawn PearceDec 15, 2006
  52. Andreas EricssonDec 15, 2006
  53. Shawn PearceDec 15, 2006
  54. Andreas EricssonDec 15, 2006
  55. Nicolas PitreDec 15, 2006
  56. Junio C HamanoDec 15, 2006
  57. Nicolas PitreDec 15, 2006
  58. Shawn PearceDec 15, 2006
  59. Junio C HamanoDec 15, 2006
  60. Nicolas PitreDec 15, 2006
  61. Junio C HamanoDec 16, 2006
  62. Junio C HamanoDec 14, 2006
  63. Andy ParkinsDec 14, 2006
  64. Junio C HamanoDec 14, 2006
  65. Andy ParkinsDec 15, 2006
  66. Raimund BauerDec 15, 2006
  67. Junio C HamanoDec 15, 2006
  68. Carl WorthDec 15, 2006
  69. Johannes SchindelinDec 14, 2006
  70. Johannes SchindelinDec 14, 2006
  71. Andy ParkinsDec 14, 2006
  72. Johannes SchindelinDec 14, 2006
  73. Andy ParkinsDec 14, 2006
  74. Johannes SchindelinDec 14, 2006
  75. Andy ParkinsDec 14, 2006
  76. Shawn PearceDec 14, 2006
  77. Andy ParkinsDec 14, 2006
  78. Nicolas PitreDec 14, 2006
  79. Andy ParkinsDec 14, 2006
  80. Shawn PearceDec 14, 2006
  81. Jakub NarebskiDec 15, 2006
  82. Junio C HamanoDec 15, 2006
  83. Jakub NarebskiDec 15, 2006
  84. Johannes SchindelinDec 15, 2006
  85. Junio C HamanoDec 15, 2006
  86. Johannes SchindelinDec 16, 2006
  87. Junio C HamanoDec 16, 2006
  88. Steven GrimmDec 16, 2006
  89. Junio C HamanoDec 16, 2006
  90. Junio C HamanoDec 15, 2006
  91. git-clone: use wildcard specification for tracking branchesJunio C Hamano, Dec 16, 2006
  92. git-pull: refuse default merge without branch.*.mergeJunio C Hamano, Dec 16, 2006
  93. git-clone: lose the artificial "first" fetch refspecJunio C Hamano, Dec 16, 2006
  94. git-clone: lose the traditional 'no-separate-remote' layoutJunio C Hamano, Dec 16, 2006
  95. Linus TorvaldsDec 16, 2006
  96. Johannes SchindelinDec 16, 2006
  97. Linus TorvaldsDec 16, 2006
  98. Jakub NarebskiDec 16, 2006
  99. Junio C HamanoDec 16, 2006
  100. Document git-merge-fileJohannes Schindelin, Dec 16, 2006
  101. Jakub NarebskiDec 16, 2006
  102. Junio C HamanoDec 16, 2006

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.