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

Re: git checkout --autostash and git branch --autopop

From
Philip Oakley <philipoakley@iee.email>
Date
Dec 14, 2019, 12:58 UTC
Message-ID
<631f1c73-b85c-29f0-6259-5468dddcd0b8@iee.email>
In-Reply-To
<DA212C7D-D8D4-4E68-8C29-AF68364653E9@ssl-mail.com>
Hi Eeli,
 thanks for the clarification
cc'ing the list.
On 14/12/2019 11:58, Eeli wrote:
Show 5 quoted lines
> Often in my work I need to checkout my coworkers’ branches. When that happens, I will likely have some uncommitted changes I would need to commit or stash.
>
> This purely an ergonomic feature I’m suggesting.
>
> So instead of git stash or git commit -m ”wip” and later git stash pop or git reset HEAD~1, I could just run git checkout -b —autostash other-branch, do the work on the other branch and return to my previous state with git checkout —autopop my-branch.

Also, c/would a detached head (rather than using -b) be part of the options if you are just doing a review?

Show 34 quoted lines
>
> Apologies if I messed up my Git usage, I have used Git through Magit for too long.
>
>> On 14. Dec 2019, at 1.12 PM, Philip Oakley <philipoakley@iee.email> wrote:
>>
>> On 13/12/2019 17:16, Junio C Hamano wrote:
>>> Philip Oakley <philipoakley@iee.email> writes:
>>>
>>>> Isn't this meant to be something similar to the --no-merge option for
>>>> checkout. That is: I am where I am, but really I want this to be on
>>>> branch X. Or is the --no-merge option meant to be something else?
>>> Is there a --no-merge option to "git checkout"?  
>> My mistake. I misremembered or misunderstood. I'd been looking at both
>> checkout and branch man pages to see if there was a way out of the do
>> the 'rewind current branch and create new branch at current state'
>> dance. I thought I'd seen 'no-merge' as a 'checkout -b' style option.
>>
>>> I know the reason
>>> why I invented "git checkout --merge" was because I wanted the
>>> command to carry more changes in the working tree than the default
>>> behaviour would while checking out another branch, but I do not
>>> think I added an option to do less, i.e. forbid it from carrying any
>>> change in the working tree while checking out another branch.
>> For creating a new branch when in a dirty state (based on some other
>> start point than HEAD), there should be an option for numpties that have
>> already started digging the hole for themselves (stick's hand up
>> apologetically)...
>>
>> I was hoping that @rottis would clarify if his request has the same
>> symptoms.
>>
>> --
>>
>> Philip
Previous: Philip Oakley
Message 7 of 7 in “git checkout --autostash and git branch --autopop”
  1. rottis@fea.stDec 12, 2019
  2. Denton LiuDec 12, 2019
  3. Denton LiuDec 12, 2019
  4. Philip OakleyDec 12, 2019
  5. Junio C HamanoDec 13, 2019
  6. Philip OakleyDec 14, 2019
  7. Philip OakleyDec 14, 2019

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.