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

Re: [PATCH] New git-seek command with documentation and test.

From
Andreas Ericsson <ae@op5.se>
Date
Feb 24, 2006, 10:00 UTC
Message-ID
<43FED93D.1000601@op5.se>
In-Reply-To
<87zmkhrf4y.wl%cworth@cworth.org>
Carl Worth wrote:
Show 5 quoted lines
> Add git-seek which allows for temporary excursions through the
> revision history. With "git seek <revision>" one gets a working tree
> corresponding to <revision>. When done with the excursion "git seek"
> returns back to the original branch from where the first seek began.
> 

I've said it before, and I'll say it again. This tool provides less flexibility and much less power than "git checkout -b branch <commit-ish>" (although it would be nice to have '-o' for 'overwrite existing branch' as an argument to git checkout)

Show 36 quoted lines
> Signed-off-by: Carl Worth <cworth@cworth.org>
> 
> ---
>  
>  I had planned to just let this drop as my original need was some
>  historical exploration that I've already finished. But now I've found
>  a common use case in my everyday workflow that could benefit from
>  git-seek. Here it is:
>  
>  I receive a bug-fix patch that updates a test case to demonstrate the
>  bug. I can apply both the fix and the test case and see it succeed.
>  But what I really want to do is first commit the test case, see it
>  fail, and only then commit the fix and see the test now succeed.  I'd
>  also like the history to reflect that order. So what I do is:
>  
>  	$ git-am
>  	$ git update-index test.c ; git commit -m "Update test"
>  	$ git update-index buggy.c ; git commit -m "Fix bug"
>  
>  At that point, without git-seek I can get by with:
>  
>  	$ git checkout -b tmp HEAD^
>  	$ make check # to see failure
>  	$ git checkout <branch_I_was_on_to_begin_with>
>  	$ git branch -d tmp # easy to forget, but breaks the next time otherwise
>  	$ make check # to see success
>  
>  But what I'd really like to do, (and can with the attached patch), is:
>  
>  	$ git seek HEAD^
>  	$ make check # to see failure
>  	$ git seek
>  	$ make check # to see success
>  
>  This avoids me having to:
> 1) invent a throwaway name,

All programmers have at least five throwaway names that are only ever used as such (mine are, in order of precedence, foo, bar, tmp, fnurg, sdf and asd).

> 2) remember the branch I started on,

With topic branches, you need to pick more careful topic names. Without topic branches you're always on "master". Surely you know what the patches touch, so you know what branch they should be in.

> 3) remember to actually throwaway the temporary branch.
> 

This isn't always a bad thing, since you after applying some patch or other decide you want to go back to this point in history, or want to keep the point so you can show the author some problem or other with the patch. With git-seek you'll then have to remember the hard-to-learn SHA1, or how far below HEAD or some other easily remembered point in history it is. In that case, you need to remember to add the branch/tag/whatever to where you seeked rather than just go on with the work. Removing a branch later is simple. Finding the right spot to create it later can be trouble-some.

If I had a vote, I'd say no to this patch, and to this tool entirely.
-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
Previous: Junio C HamanoNext: Junio C Hamano
Message 25 of 57 in “several quick questions”
  1. Nicolas Vilz 'niv'Feb 14, 2006
  2. Andreas EricssonFeb 14, 2006
  3. Nicolas Vilz 'niv'Feb 14, 2006
  4. Linus TorvaldsFeb 14, 2006
  5. Kenneth JohanssonFeb 14, 2006
  6. Andreas EricssonFeb 14, 2006
  7. Kenneth JohanssonFeb 14, 2006
  8. Linus TorvaldsFeb 14, 2006
  9. Carl WorthFeb 14, 2006
  10. Linus TorvaldsFeb 14, 2006
  11. Carl WorthFeb 14, 2006
  12. Petr BaudisFeb 14, 2006
  13. Johannes SchindelinFeb 14, 2006
  14. Junio C HamanoFeb 14, 2006
  15. Johannes SchindelinFeb 14, 2006
  16. Petr BaudisFeb 14, 2006
  17. Linus TorvaldsFeb 14, 2006
  18. Petr BaudisFeb 14, 2006
  19. Carl WorthFeb 14, 2006
  20. Junio C HamanoFeb 14, 2006
  21. New git-seek command with documentation and test.Carl Worth, Feb 23, 2006
  22. J. Bruce FieldsFeb 24, 2006
  23. git-seek: Eliminate spurious warning. Fix errant reference to git-bisect in docs.Carl Worth, Feb 24, 2006
  24. Junio C HamanoFeb 24, 2006
  25. Andreas EricssonFeb 24, 2006
  26. Junio C HamanoFeb 24, 2006
  27. Carl WorthFeb 24, 2006
  28. Johannes SchindelinFeb 24, 2006
  29. J. Bruce FieldsFeb 24, 2006
  30. Josef WeidendorferFeb 14, 2006
  31. Junio C HamanoFeb 14, 2006
  32. Josef WeidendorferFeb 14, 2006
  33. Junio C HamanoFeb 14, 2006
  34. More useful/hinting error messages in git-checkoutJosef Weidendorfer, Feb 15, 2006
  35. Andreas EricssonFeb 14, 2006
  36. Johannes SchindelinFeb 14, 2006
  37. Andreas EricssonFeb 15, 2006
  38. Junio C HamanoFeb 15, 2006
  39. Junio C HamanoFeb 15, 2006
  40. Andreas EricssonFeb 15, 2006
  41. Junio C HamanoFeb 15, 2006
  42. Petr BaudisFeb 14, 2006
  43. Carl WorthFeb 14, 2006
  44. Linus TorvaldsFeb 14, 2006
  45. Andreas EricssonFeb 14, 2006
  46. Johannes SchindelinFeb 14, 2006
  47. Carl WorthFeb 14, 2006
  48. Keith PackardFeb 14, 2006
  49. Linus TorvaldsFeb 14, 2006
  50. Keith PackardFeb 14, 2006
  51. Martin LanghoffFeb 15, 2006
  52. Keith PackardFeb 15, 2006
  53. Carl WorthFeb 15, 2006
  54. Junio C HamanoFeb 14, 2006
  55. Petr BaudisFeb 14, 2006
  56. Cogito turbo-introductionPetr Baudis, Feb 15, 2006
  57. Petr BaudisFeb 15, 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.