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
Björn Steinbrink <b.steinbrink@gmx.de>
Date
Oct 17, 2009, 08:40 UTC
Message-ID
<20091017084025.GC5474@atjola.homenet>
In-Reply-To
<7vws2ue8yc.fsf@alter.siamese.dyndns.org>
On 2009.10.17 01:11:23 -0700, Junio C Hamano wrote:
Show 18 quoted lines
> Björn Steinbrink <B.Steinbrink@gmx.de> writes:
> 
> > ... If so, it does a "git checkout --merge
> > <upstream>" (possibly leaving conflicts for the uncommitted changes,
> > just like "svn update").
> 
> Up to this point I was reading with quite a lot of interest.  But here I
> strongly disagree to the point of getting actually disgusted.
> 
> "svn up" is one of the areas Subversion folks failed to make their system
> a better CVS.  It has the same "local changes are lost in the merge
> conflict mess in an irreversible way" failure mode, and we shouldn't be
> making it easy to new people.  It is not something we should emulate.
> 
> You can and should instead refuse the update, and suggest committing first
> so that the user has a safe record of what he has done and the merge with
> upstream can be retried if necessary.  As you need to have that "refuse
> but guide the lost soul by telling what to do" mode anyway when...

Hm, probably I (mentally) focussed to much on "people that just want to look" and didn't really think that they'd have much to lose. Not sure. Over the time, I got so used to do "git checkout --merge <something>" with some I-don't-care-much debugging or whatever change, that I lost track of how bad that was with svn. If I have just I care about, I commit, and then "git update" would no longer be an option anyway. But yeah, not a good option to give to the uninitiated user...

Interestingly, I irregularly give advice to use "git stash; git checkout; git stash apply" instead of "git checkout -m" on #git, as that allows you to try again if you messed up the conflict resolution, and even allows you to completely go back to the initial state. Maybe that would be an option? But I fail to come up with a convenient and at the same time error safe way for such a "stash wrap". The only thing that comes to mind would be to have "git update" completely wrapping the thing:

git update
 - Stashes uncommitted changes
 - fetches
 - checks out
 - "stash apply --index", if that fails, just "stash apply"
If there are conflicts, show options (similar to what rebase does):
git update --retry # Start over
 - reset --hard
 - "stash apply --index", if that fails, just "stash apply"
git update --abort
 - git reset --hard HEAD@{1}
 - "stash apply --index"
 - "stash drop stash@{0}"
git update --done
 - Check whether there are still unmerged files, if so: complain
 - otherwise: "stash drop stash@{0}"

OTOH, it might be easier to just tell the user to do the stash thing himself. But I wonder how many users would really know how to get back to the initial state then.

Björn
Previous: Junio C HamanoNext: Junio C Hamano
Message 81 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.