git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git checkout --autostash and git branch  --autopop
@ 2019-12-12 12:19 rottis
  2019-12-12 18:09 ` Denton Liu
  0 siblings, 1 reply; 7+ messages in thread
From: rottis @ 2019-12-12 12:19 UTC (permalink / raw)
  To: git

Hello,

I'm not sure if this has been discussed in the past, but I would like to humbly request this feature. Let me explain:

Similar to the 'git rebase --autostash', running 'git checkout --autostash' would automatically stash uncommitted changes for the
current branch.  then running 'git branch --autopop' would automatically apply an automatic stash when switching to a branch that had one.

Thank you.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: git checkout --autostash and git branch  --autopop
  2019-12-12 12:19 git checkout --autostash and git branch --autopop rottis
@ 2019-12-12 18:09 ` Denton Liu
  2019-12-12 18:12   ` Denton Liu
  2019-12-12 22:02   ` Philip Oakley
  0 siblings, 2 replies; 7+ messages in thread
From: Denton Liu @ 2019-12-12 18:09 UTC (permalink / raw)
  To: rottis; +Cc: git

Hi rottis,

On Thu, Dec 12, 2019 at 02:19:50PM +0200, rottis@fea.st wrote:
> Similar to the 'git rebase --autostash', running 'git checkout --autostash' would automatically stash uncommitted changes for the
> current branch.  then running 'git branch --autopop' would automatically apply an automatic stash when switching to a branch that had one.

I currently have a WIP version of this feature but I haven't had enough
time to polish it off (tests and docs). The last RFC round can be seen
here[1] if you want to test it out. It seems to work well enough for
personal use.

[1]: https://lore.kernel.org/git/cover.1571246693.git.liu.denton@gmail.com/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: git checkout --autostash and git branch  --autopop
  2019-12-12 18:09 ` Denton Liu
@ 2019-12-12 18:12   ` Denton Liu
  2019-12-12 22:02   ` Philip Oakley
  1 sibling, 0 replies; 7+ messages in thread
From: Denton Liu @ 2019-12-12 18:12 UTC (permalink / raw)
  To: rottis; +Cc: git

On Thu, Dec 12, 2019 at 10:09:01AM -0800, Denton Liu wrote:
> Hi rottis,
> 
> On Thu, Dec 12, 2019 at 02:19:50PM +0200, rottis@fea.st wrote:
> > Similar to the 'git rebase --autostash', running 'git checkout --autostash' would automatically stash uncommitted changes for the
> > current branch.  then running 'git branch --autopop' would automatically apply an automatic stash when switching to a branch that had one.
> 
> I currently have a WIP version of this feature but I haven't had enough
> time to polish it off (tests and docs). The last RFC round can be seen
> here[1] if you want to test it out. It seems to work well enough for
> personal use.

Sorry, my mistake. I misread your message; my topic was for
`git merge --autostash`. However, it does generalise the autostash
machinery so perhaps it'll be simpler to implement it into checkout in
the future, if that's desired?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: git checkout --autostash and git branch --autopop
  2019-12-12 18:09 ` Denton Liu
  2019-12-12 18:12   ` Denton Liu
@ 2019-12-12 22:02   ` Philip Oakley
  2019-12-13 17:16     ` Junio C Hamano
  1 sibling, 1 reply; 7+ messages in thread
From: Philip Oakley @ 2019-12-12 22:02 UTC (permalink / raw)
  To: Denton Liu, rottis; +Cc: git

On 12/12/2019 18:09, Denton Liu wrote:
> Hi rottis,
>
> On Thu, Dec 12, 2019 at 02:19:50PM +0200, rottis@fea.st wrote:
>> Similar to the 'git rebase --autostash', running 'git checkout --autostash' would automatically stash uncommitted changes for the
>> current branch.  then running 'git branch --autopop' would automatically apply an automatic stash when switching to a branch that had one.
> I currently have a WIP version of this feature but I haven't had enough
> time to polish it off (tests and docs). The last RFC round can be seen
> here[1] if you want to test it out. It seems to work well enough for
> personal use.
>
> [1]: https://lore.kernel.org/git/cover.1571246693.git.liu.denton@gmail.com/
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?
--
Philip

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: git checkout --autostash and git branch --autopop
  2019-12-12 22:02   ` Philip Oakley
@ 2019-12-13 17:16     ` Junio C Hamano
  2019-12-14 11:12       ` Philip Oakley
  0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2019-12-13 17:16 UTC (permalink / raw)
  To: Philip Oakley; +Cc: Denton Liu, rottis, git

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"?  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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: git checkout --autostash and git branch --autopop
  2019-12-13 17:16     ` Junio C Hamano
@ 2019-12-14 11:12       ` Philip Oakley
       [not found]         ` <DA212C7D-D8D4-4E68-8C29-AF68364653E9@ssl-mail.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Philip Oakley @ 2019-12-14 11:12 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Denton Liu, rottis, git

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: git checkout --autostash and git branch --autopop
       [not found]         ` <DA212C7D-D8D4-4E68-8C29-AF68364653E9@ssl-mail.com>
@ 2019-12-14 12:58           ` Philip Oakley
  0 siblings, 0 replies; 7+ messages in thread
From: Philip Oakley @ 2019-12-14 12:58 UTC (permalink / raw)
  To: Eeli, Git List; +Cc: Junio C Hamano, Denton Liu

Hi Eeli,
 thanks for the clarification
cc'ing the list.

On 14/12/2019 11:58, Eeli wrote:
> 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?
>
> 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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-12-14 12:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-12 12:19 git checkout --autostash and git branch --autopop rottis
2019-12-12 18:09 ` Denton Liu
2019-12-12 18:12   ` Denton Liu
2019-12-12 22:02   ` Philip Oakley
2019-12-13 17:16     ` Junio C Hamano
2019-12-14 11:12       ` Philip Oakley
     [not found]         ` <DA212C7D-D8D4-4E68-8C29-AF68364653E9@ssl-mail.com>
2019-12-14 12:58           ` Philip Oakley

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).