public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: erik88 <erik88@gmail.com>
Cc: Mirko Faina <mroik@delayed.space>,
	 Aron Sigfridsson <aron.sigfridsson@gmail.com>,
	 git@vger.kernel.org
Subject: Re: Git reference git stash
Date: Fri, 06 Mar 2026 13:50:00 -0800	[thread overview]
Message-ID: <xmqqv7f8y6ev.fsf@gitster.g> (raw)
In-Reply-To: <aarHnK-oPHlx_hCw@Eriks-MacBook-Pro.local> (erik's message of "Fri, 6 Mar 2026 13:29:50 +0100")

erik88 <erik88@gmail.com> writes:

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

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

      reply	other threads:[~2026-03-06 21:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-05 20:07 Git reference git stash Aron Sigfridsson
2026-03-06  2:09 ` Mirko Faina
2026-03-06  2:31   ` Mirko Faina
2026-03-06 12:29     ` erik88
2026-03-06 21:50       ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqv7f8y6ev.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=aron.sigfridsson@gmail.com \
    --cc=erik88@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=mroik@delayed.space \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox