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

Re: [PATCH] Proof-of-concept patch to remember what the detached HEAD was

From
Julian Phillips <julian@quantumfyre.co.uk>
Date
Oct 16, 2009, 17:31 UTC
Message-ID
<alpine.LNX.2.00.0910161821230.30589@reaper.quantumfyre.co.uk>
In-Reply-To
<20091016143041.GA11821@atjola.homenet>
On Fri, 16 Oct 2009, Bj?rn Steinbrink wrote:
Show 32 quoted lines
> On 2009.10.16 13:15:35 +0100, Julian Phillips wrote:
>> On Thu, 15 Oct 2009, Daniel Barkalow wrote:
>>
>>> On Thu, 15 Oct 2009, James Pickens wrote:
>>>
>>>> How about not detaching the head at all if the user checks out any ref, and
>>>> reject commits if he checked out a tag or remote branch.  For example:
>>>>
>>>> $ git checkout origin/master
>>>> $ git status
>>>> # On branch origin/master
>>>> $ git commit ;# complain
>>>
>>> $ git checkout origin/master
>>> $ git fetch
>>> $ git checkout origin/next
>>> Uncommited file '...' would be overwritten.
>>
>> How about:
>>
>> $ git checkout origin/master
>> $ git fetch
>> Refusing to fetch, as it would update a checkedout branch
>> "git fetch -f" will force the update, but you will need to run "git
>> reset --hard HEAD" to update your checkout to match.
>
> That would redefine -f (currently means "allow non-fast-forward
> updates"), the flag that allows the checked out branch head to be
> updated is -u, --update-head-ok, and is for internal use only.
>
> And suggesting "reset --hard" seems wrong, that just kills any
> uncommitted changes.
Ok, so the commands were wrong.  Not important.

It was the approach that I was trying to suggest rather than the actual commands. The point I was trying to make was how, as a user, I would be happy to git behave.

So, I try to run fetch, git says "ooh, now that would be dangerous - you can force it happen by running "git foo", but you will then be in situation X, which you can then recover from by running "git bar", though you may need to run "git stash" to save any edits you have made" or something similar.

Now as a user I know that I have tried to do something a bit unusual, but I don't have to run to the mailing list or #git saying "I just did X Y Z and everything is now FUBARed". I can even proceed to do the unusal thing, as git itself has given me the information I need to sort things out afterwards.

Show 7 quoted lines
> And such uncommitted changes would be lost in the big "undo the fetch
> update" diff. So you'd have to do:
> git reset --soft HEAD@{1}
> git checkout --merge HEAD@{1}
>
> to keep them, while updating to the new state of the remote tracking
> branch. Not quite intuitive, is it?

I don't care what git has to do, I'm talking about the user experience - if we have to write some new code to support it, that really isn't a terribly hard thing to do. UIs should be driven down from the user interaction not up from the implementation.

-- 
Julian

  ---
Captain: "Catalyzer's a nothing part, captain."

Mal: "It's nothing until you don't got one. Then it appears to be everything."
 				--Episode #8, "Out of Gas"
Previous: Björn SteinbrinkNext: Daniel Barkalow
Message 65 of 93 in “Proof-of-concept patch to remember what the detached HEAD was”
  1. Proof-of-concept patch to remember what the detached HEAD wasDaniel Barkalow, Oct 14, 2009
  2. Junio C HamanoOct 14, 2009
  3. Jeff KingOct 14, 2009
  4. Johannes SchindelinOct 14, 2009
  5. Jeff KingOct 14, 2009
  6. Junio C HamanoOct 14, 2009
  7. Jeff KingOct 14, 2009
  8. Daniel BarkalowOct 14, 2009
  9. Jay SoffianOct 14, 2009
  10. Daniel BarkalowOct 14, 2009
  11. Nicolas PitreOct 14, 2009
  12. Daniel BarkalowOct 14, 2009
  13. Junio C HamanoOct 14, 2009
  14. Nicolas PitreOct 14, 2009
  15. Junio C HamanoOct 14, 2009
  16. Jeff KingOct 14, 2009
  17. Nicolas PitreOct 14, 2009
  18. Junio C HamanoOct 15, 2009
  19. Jeff KingOct 15, 2009
  20. Nicolas PitreOct 15, 2009
  21. Jeff KingOct 15, 2009
  22. Johannes SchindelinOct 16, 2009
  23. Nicolas PitreOct 16, 2009
  24. Johannes SchindelinOct 16, 2009
  25. Nicolas PitreOct 16, 2009
  26. Junio C HamanoOct 16, 2009
  27. Sean EstabrooksOct 17, 2009
  28. Johannes SchindelinOct 26, 2009
  29. Nanako ShiraishiOct 27, 2009
  30. Making Git easy to use -- without RTFM, was Re: [PATCH] Proof-of-concept patch to remember what the detached HEAD wasJohannes Schindelin, Oct 27, 2009
  31. Avery PennarunOct 27, 2009
  32. Johannes SchindelinOct 16, 2009
  33. Junio C HamanoOct 16, 2009
  34. James PickensOct 15, 2009
  35. Jakub NarebskiOct 15, 2009
  36. Björn SteinbrinkOct 15, 2009
  37. Nicolas PitreOct 15, 2009
  38. Daniel BarkalowOct 15, 2009
  39. Michael J GruberOct 15, 2009
  40. Nicolas PitreOct 15, 2009
  41. Daniel BarkalowOct 15, 2009
  42. Thomas RastOct 15, 2009
  43. Nicolas PitreOct 15, 2009
  44. Junio C HamanoOct 15, 2009
  45. Jeff KingOct 15, 2009
  46. Junio C HamanoOct 15, 2009
  47. Junio C HamanoOct 15, 2009
  48. Nicolas PitreOct 15, 2009
  49. James PickensOct 15, 2009
  50. Nicolas PitreOct 16, 2009
  51. Johannes SchindelinOct 16, 2009
  52. Björn SteinbrinkOct 16, 2009
  53. Jeff KingOct 15, 2009
  54. Jeff KingOct 15, 2009
  55. Björn SteinbrinkOct 16, 2009
  56. Daniel BarkalowOct 16, 2009
  57. Björn SteinbrinkOct 16, 2009
  58. Nicolas PitreOct 16, 2009
  59. Daniel BarkalowOct 15, 2009
  60. Junio C HamanoOct 15, 2009
  61. Daniel BarkalowOct 15, 2009
  62. Nicolas PitreOct 15, 2009
  63. Julian PhillipsOct 16, 2009
  64. Björn SteinbrinkOct 16, 2009
  65. Julian PhillipsOct 16, 2009
  66. Daniel BarkalowOct 16, 2009
  67. Junio C HamanoOct 16, 2009
  68. Julian PhillipsOct 16, 2009
  69. Nicolas PitreOct 16, 2009
  70. Julian PhillipsOct 17, 2009
  71. Björn SteinbrinkOct 17, 2009
  72. Julian PhillipsOct 17, 2009
  73. Björn SteinbrinkOct 17, 2009
  74. Julian PhillipsOct 17, 2009
  75. Junio C HamanoOct 16, 2009
  76. Julian PhillipsOct 17, 2009
  77. Junio C HamanoOct 17, 2009
  78. Julian PhillipsOct 17, 2009
  79. Björn SteinbrinkOct 17, 2009
  80. Junio C HamanoOct 17, 2009
  81. Björn SteinbrinkOct 17, 2009
  82. Junio C HamanoOct 17, 2009
  83. James PickensOct 17, 2009
  84. Björn SteinbrinkOct 17, 2009
  85. Junio C HamanoOct 18, 2009
  86. Björn SteinbrinkOct 19, 2009
  87. Julian PhillipsOct 17, 2009
  88. Eric RaibleOct 14, 2009
  89. Christoph BartoschekOct 16, 2009
  90. Junio C HamanoOct 17, 2009
  91. Björn SteinbrinkOct 17, 2009
  92. Junio C HamanoOct 17, 2009
  93. Daniel BarkalowOct 17, 2009

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.