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

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

 



Philip Oakley <philipoakley@iee.email> writes:

> Hi, some minor comments, in-line.
>
> On 13/01/2022 16:29, Colin Kennedy wrote:
>> 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.

True.

Also, a dashed option and its argument should come before the
non-dashed arguments, so if it were a good idea to introduce a new
option, it should come after "git stash branch" and "<branchname>",
not after "<branchname>".

Most importantly, this particular new option is unnecessary and
is probably unwanted.

The original "git stash branch" relieves the user from finding out
the commit where the stash was taken from, which is its value over
its long-hand equivalent, i.e.

	git checkout -b <name> refs/stash^ &&
	git stash pop

The long-hand version forces the user to know that the first parent
of the commit that represents a stash entry is the original commit
the stash entry was taken from.  With "git stash branch <name>", the
user does not need to know it.

But the --from discards the only reason why "stash branch" subcommand
needs to exist.  It would be equivalent to

	git checkout -b <name> <rootbranch> &&
	git stash pop

and it is not helping the user, unlike the original that allowed the
user to be oblivious to the internal implementation detail of a
stash entry.

Or am I failing to see some obvious improvements over the longhand?

Worse, the application and discarding of the stash entry done by the
"git stash branch" is guaranteed to apply cleanly, as we'd be
applying the stash to its exact original state.  The trees of
<rootbranch> and refs/stash^, on the other hand, can be vastly
different, and applying the stash on top of <rootbranch> commit can
fail.

In short, I am not enthused.

Thanks.



[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