Re: [PATCH] Disconnect stash from its base commit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes:

>> This patch changes the structure of a stash to use a parentless new 
>> commit that has the same tree as the HEAD commit, in place of the HEAD 
>> commit. This way, a stash does not keep the history that leads to the 
>> HEAD commit reachable, even if the stash is kept forever.
>
> May I register my suspicion that this is the wrong direction to go?
>
> I actually find it quite nice that I can easily see in gitk where I 
> spawned off a certain stash, indeed, how the recent stash history 
> (manually specified with "stash@{0} stash@{1} stash@{2}" [*1*]), relates 
> to the current branch's history.

A stash may primarily be for applying the change to random place, but
where it was created is not a useless information.  The very original use
case that was in the discussion "git stash" (actually its original form
"git save") was first posted was "I am in the middle of something, and get
interrupted.  Stash the changes away to switch branches to deal with the
emergency for a while so that I can later come back to where I was, and I
want both saving away and coming back easy operations".  A stash _can_ be
applied to any random other state, but "coming back" is very much part of
what it should have supported, and not recording the base commit means we
would lose that capability.

	Side note.  In addition to the current "stash apply" and "stash
	pop", "stash branch $stash newbranchname" that does

        	git checkout -b newbranchanme $stash^

	(i.e. create a new branch starting from the state you were in)
	might be a good ingredient to support a more git-like workflow to
	resume.  If your original branch gained extra commits, was
	rewound, or was rebased during the emergency/distraction, you may
	not have anywhere to apply/pop the stash without conflicts when
	you want to "come back" with normal

        	git checkout somebranch && git stash pop

	But that imaginary "stash branch" command would always give you
	the exact state you were in and creates a clean fork to finish
	what you were doing, and continue.

So the base commit is an integral part of what a stash is, and I agree
with you that an unexpiring stash that pins the whole history beind it is
a feature.  It is not unncessary cruft that accumulates that we need to
worry about.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux