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

Re: feature request: add [-f|--from <rootbranch>] to git stash branch

From
Philip Oakley <philipoakley@iee.email>
Date
Jan 14, 2022, 14:53 UTC
Message-ID
<851ecd86-02d0-b078-1c90-ebe75ad46926@iee.email>
In-Reply-To
<2a4f90e9-9abb-40b6-a6f3-a676567e4fc0@www.fastmail.com>
Hi, some minor comments, in-line.
On 13/01/2022 16:29, Colin Kennedy wrote:
Show 7 quoted lines
> Current syntax of git stash branch is:
>
> branch <branchname> [<stash>]
>
> Proposed syntax is:
>
> branch <branchname> [-f|--from <rootbranch>] [<stash>]

Just to say that the `-f` is typically reserved/used for the --force option if available.

Show 8 quoted lines
>
> the from flag specifies a branch from which the new branch should be derived.
>
> Example usage:
>
> git stash branch remove-commented-code --from main
>
> This simplifies a workflow which is common for me. I am working N-commits deep in some feature branch when I discover a low hanging fruit. Dealing with this low hanging fruit is not appropriate for the current feature branch. It's most appropriate to deal with "directly" on a fresh branch from main. Because I am untidy, 

Maybe an example that shows the level of untidiness might help to clarify the suggestion, as to what is included/not included, and how it makes it easy later when the stash is recovered.

Show 8 quoted lines
> I often have a bit of mess in between my staging area, and unstaged changes, and this creates friction when I attempt to stash this low hanging fruit, pop back to main, create the new branch, pop the stashed low hanging fruit, etc etc.
>
> The proposed flag gives a one-liner to apply stashed patches wherever, no matter your current location, which I think is an improvement.
>
> Happy to have feedback on the flag. Happy for someone else to implement it. Also happy to consider taking a crack at it myself if it seems like something people would be happy to include. (NB: I haven't written or even read any c, or c++ for that matter, in probably 15 years. So, you know).
>
> thanks,
> Colin
Previous: Colin KennedyNext: Junio C Hamano
Message 2 of 3 in “feature request: add [-f|--from <rootbranch>] to git stash branch”
  1. Colin KennedyJan 13, 2022
  2. Philip OakleyJan 14, 2022
  3. Junio C HamanoJan 14, 2022

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.