Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Post History

66%
+2 −0
Q&A Filter stashes by pathspec

The documentation for git stash list says list [<log-options>] List the stash entries that you currently have. Each stash entry is listed with its name (e.g. stash@{0} is the latest entry...

0 answers  ·  posted 9mo ago by Michael‭  ·  edited 3mo ago by Michael‭

Question git git-stash git-log
#3: Post edited by user avatar Michael‭ · 2024-09-19T21:09:20Z (3 months ago)
Quote the doc directly, for clarity
  • [The documentation][doc] for `git stash list` says
  • > ### [`list [<log-options>]`][doc]
  • > List the stash entries that you currently have. Each **stash entry** is listed with its name (e.g. `stash@{0}` is the latest entry, `stash@{1}` is the one before, etc.), the name of the branch that was current when the entry was made, and a short description of the commit the entry was based on.
  • > ```
  • > stash@{0}: WIP on submit: 6ebd0e2... Update git-stash documentation
  • > stash@{1}: On master: 9cc0589... Add git-stash
  • > ```
  • > The command takes options applicable to the **git log** command to control what is shown and how. See [git-log[1]][log].
  • If I run an ordinary `git stash list`, it shows me a list of `stash@{N}`, with lots of "WIP on branch1," "WIP on branch2," and so on.
  • But if I try `git stash list -- doc` to look for stashes specifically affecting documentation, it does this&hellip;
  • ```
  • fatal: bad revision 'doc'
  • ```
  • Why can't I use paths if it says I can use "log" options? Is it possible to get the list of stashes that touch a certain pathspec?
  • [doc]: https://git-scm.com/docs/git-stash#Documentation/git-stash.txt-listltlog-optionsgt
  • [log]: https://git-scm.com/docs/git-log
  • [The documentation][doc] for `git stash list` says
  • > ### [`list [<log-options>]`][doc]
  • > List the stash entries that you currently have. Each **stash entry** is listed with its name (e.g. `stash@{0}` is the latest entry, `stash@{1}` is the one before, etc.), the name of the branch that was current when the entry was made, and a short description of the commit the entry was based on.
  • > ```
  • > stash@{0}: WIP on submit: 6ebd0e2... Update git-stash documentation
  • > stash@{1}: On master: 9cc0589... Add git-stash
  • > ```
  • > The command takes options applicable to the **git log** command to control what is shown and how. See [git-log[1]][log].
  • If I run an ordinary `git stash list`, it shows me a list of `stash@{N}`, with lots of "WIP on branch1," "WIP on branch2," and so on.
  • But if I try `git stash list -- doc` to look for stashes specifically affecting documentation, it does this&hellip;
  • ```
  • fatal: bad revision 'doc'
  • ```
  • If [the documentation says][doc] I can use _"options applicable to the **git log** command,"_ why won't it let me use path filtering? Is it possible to get the list of stashes that touch a certain pathspec?
  • [doc]: https://git-scm.com/docs/git-stash#Documentation/git-stash.txt-listltlog-optionsgt
  • [log]: https://git-scm.com/docs/git-log
#2: Post edited by user avatar Alexei‭ · 2024-03-30T05:39:57Z (9 months ago)
added relevant tags
#1: Initial revision by user avatar Michael‭ · 2024-03-29T20:42:02Z (9 months ago)
Filter stashes by pathspec
[The documentation][doc] for `git stash list` says

> ### [`list [<log-options>]`][doc]
> List the stash entries that you currently have. Each **stash entry** is listed with its name (e.g. `stash@{0}` is the latest entry, `stash@{1}` is the one before, etc.), the name of the branch that was current when the entry was made, and a short description of the commit the entry was based on.
> ```
> stash@{0}: WIP on submit: 6ebd0e2... Update git-stash documentation
> stash@{1}: On master: 9cc0589... Add git-stash
> ```
> The command takes options applicable to the **git log** command to control what is shown and how. See [git-log[1]][log].

If I run an ordinary `git stash list`, it shows me a list of `stash@{N}`, with lots of "WIP on branch1," "WIP on branch2," and so on.

But if I try `git stash list -- doc` to look for stashes specifically affecting documentation, it does this&hellip;

```
fatal: bad revision 'doc'
```

Why can't I use paths if it says I can use "log" options? Is it possible to get the list of stashes that touch a certain pathspec?

[doc]: https://git-scm.com/docs/git-stash#Documentation/git-stash.txt-listltlog-optionsgt
[log]: https://git-scm.com/docs/git-log