Re: Git reference git stash
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 6, 2026, 21:50 UTC
- Message-ID
- <xmqqv7f8y6ev.fsf@gitster.g>
- In-Reply-To
- <aarHnK-oPHlx_hCw@Eriks-MacBook-Pro.local>
erik88 <erik88@gmail.com> writes:
Show 11 quoted lines
> Pretty sure git stash push is the only one which does pathspec > > git stash -h > usage: git stash list [<log-options>] > ... > or: git stash [push [-p | --patch] [-S | --staged] [-k | --[no-] > [-u | --include-untracked] [-a | --all] [(-m | --m > [--pathspec-from-file=<file> [--pathspec-file-nul] > [--] [<pathspec>...]] > > and pretty sure it's relative.
In a very early days of Git, I suspect there were, but in modern version with ":/" (or :(top)" pathspec magic, I do not think of a need for any command (unless it cannot work from anywhere except for the top level of the working tree for some reason) to insist taking pathspec from the top, not relative to the directory where the user is at. It would break the <TAB>-completion if anything insists that the pathspec must be relative to the top-level.
It may be a very good exercise (this can be done even by somebody relatively new to the community, I think) to see if anything still insists <pathspec> from the top. And change the documentation of the pathspec to say "unless specifically spelled out in each command's documentation, pathspec elements are taken as relative to the current directory" or something.
Show 6 quoted lines
> Sadly, git stash list does not allow a pathspec, despite the > [<log-options>]. But if you want you can do > > git log stash [<log-options>] [--] [<pathspec>] > > instead, which is handy sometimes.