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

Re: The git newbie experience

From
Junio C Hamano <junkio@cox.net>
Date
May 15, 2006, 21:10 UTC
Message-ID
<7vlkt3gfjz.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<877j4nvx2w.wl%cworth@cworth.org>
Carl Worth <cworth@cworth.org> writes:
Show 10 quoted lines
> In particular, when using checkout to change branches, unless I've
> specifically stated with "-m" that I want to carry my changes along, I
> would like git to stash my working tree "into" the branch I'm
> switching away from.
>
> Similarly, when switching to a branch, I'd like to have the working
> tree restored to what it was the last time I switched away from that
> branch.
>
> Does that seem unreasonable to anyone?

I would not call it unreasonable to want to have an easy access to that mode of operation _as_ _well_, as an option.

If you were suggesting to make it the only way for future git to work (I think you are not), then it sounds very unreasonable to me.

The implementation behind the scene does not matter, but I think set of "stashes" that can be attached to each branch would work well for what you would want. OTOH, isn't it called stgit?

The reason why I want it to stay as an option is because I often do a throw-away patch on top of whatever branch is checked out in my working tree while reading the list traffic to compose a response with an alternative patch. Usually I follow that by a "git reset" once the message is sent out, but when I like the idea well enough, I do "checkout -b jc/that-topic master" to switch to a new branch with the dirty state carried along, to work on it further. I do not want that workflow to require -m flag, which means something different (-m means "I accept the possibility of the three-way merge failing while doing this switch that needs a merge"). Instead, I want "checkout -b" to try carrying state forward and stop if it cannot without file-level merging (i.e. the current behaviour). Then I can think if I want to do a stash with "git diff", or if I want to do the temporary branch not based on "master" but the current branch (which is guaranteed to work without -m) and deal with the mess later.

Previous: Carl WorthNext: Shawn Pearce
Message 11 of 12 in “The git newbie experience”
  1. Tommi VirtanenMay 14, 2006
  2. Junio C HamanoMay 14, 2006
  3. Junio C HamanoMay 14, 2006
  4. Tommi VirtanenMay 15, 2006
  5. Junio C HamanoMay 15, 2006
  6. Shawn PearceMay 15, 2006
  7. Junio C HamanoMay 15, 2006
  8. Carl BaldwinMay 15, 2006
  9. Junio C HamanoMay 15, 2006
  10. Carl WorthMay 15, 2006
  11. Junio C HamanoMay 15, 2006
  12. Shawn PearceMay 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.