{"thread":{"id":"65142","subject":"Git reference git stash","startedAt":"2026-03-05T20:07:56Z","lastAt":"2026-03-06T21:50:04Z","messageCount":5,"participants":["Aron Sigfridsson","Mirko Faina","erik88","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"537994","messageId":"CAB0c_PjtTs8dWJCoUnQfCUM_YOaK3e3FcZfCgWjTOLcNWj-6nA@mail.gmail.com","threadId":"65142","inReplyTo":null,"subject":"Git reference git stash","fromName":"Aron Sigfridsson","fromEmail":"aron.sigfridsson@gmail.com","sentAt":"2026-03-05T20:07:28Z","receivedAt":"2026-03-05T20:07:56Z","isPatch":false,"sender":{"key":"aron.sigfridsson@gmail.com","avatar":null},"body":"Hi!\n\nIn the reference for git stash there is a section that specifies the\nuse of the pathspec option. It refers you to the gitglossary section\nabout pathspec for further information. In the glossary it states:\n\"See the documentation of each command for whether paths are relative\nto the current directory or toplevel\"\n\nIn the documentation for git stash I can't find any information about\nwhether it is top level or relative to current directory. Am I missing\nsomething, or is the information not there?\n\nThank you for your work!\n\nAron\n"},{"id":"538045","messageId":"aao1hFwJYpJymY3o@exploit","threadId":"65142","inReplyTo":"CAB0c_PjtTs8dWJCoUnQfCUM_YOaK3e3FcZfCgWjTOLcNWj-6nA@mail.gmail.com","subject":"Re: Git reference git stash","fromName":"Mirko Faina","fromEmail":"mroik@delayed.space","sentAt":"2026-03-06T02:09:15Z","receivedAt":"2026-03-06T02:09:24Z","isPatch":false,"sender":{"key":"mroik@delayed.space","avatar":"https://avatars.githubusercontent.com/u/25752903?v=4"},"body":"It doesn't seem to be specified at all, but from a quick test you can\nsee for yourself that \"git stash push <pathspec>\" uses relative paths\nfrom the current directory and not the toplevel one.\n\nTo be sure on what's the relative path to use you can check the output\nfrom \"git status\".\n\nMaybe it should be added to the documentation for \"git stash\".\n"},{"id":"538049","messageId":"aao7uLxQ0ir0m6s2@exploit","threadId":"65142","inReplyTo":"aao1hFwJYpJymY3o@exploit","subject":"Re: Git reference git stash","fromName":"Mirko Faina","fromEmail":"mroik@delayed.space","sentAt":"2026-03-06T02:31:33Z","receivedAt":"2026-03-06T02:31:36Z","isPatch":false,"sender":{"key":"mroik@delayed.space","avatar":"https://avatars.githubusercontent.com/u/25752903?v=4"},"body":"On Fri, Mar 06, 2026 at 03:09:15AM +0100, Mirko Faina wrote:\n> It doesn't seem to be specified at all, but from a quick test you can\n> see for yourself that \"git stash push <pathspec>\" uses relative paths\n> from the current directory and not the toplevel one.\n> \n> To be sure on what's the relative path to use you can check the output\n> from \"git status\".\n> \n> Maybe it should be added to the documentation for \"git stash\".\n\nLooking at the docs for other commands that use pathspec, it doesn't\nlook like any of them explicitly say if it's toplevel or relative\nneither. I suppose the author thought it was obvious which one it was,\nbesides, it can be easily checked just by trying out the command.\n"},{"id":"538069","messageId":"aarHnK-oPHlx_hCw@Eriks-MacBook-Pro.local","threadId":"65142","inReplyTo":"aao7uLxQ0ir0m6s2@exploit","subject":"Re: Git reference git stash","fromName":"erik88","fromEmail":"erik88@gmail.com","sentAt":"2026-03-06T12:29:50Z","receivedAt":"2026-03-06T12:29:54Z","isPatch":false,"sender":{"key":"erik88@gmail.com","avatar":"https://gravatar.com/avatar/6cb3fef6cd32055e1edaef37a5ee6191184a71637659bdebcfbab87ac1be1d7d?d=mp&s=160"},"body":"On 26/03/06 03:31AM, Mirko Faina wrote:\n> \n> Looking at the docs for other commands that use pathspec, it doesn't\n> look like any of them explicitly say if it's toplevel or relative\n> neither. I suppose the author thought it was obvious which one it was,\n> besides, it can be easily checked just by trying out the command.\n> \n\nPretty sure git stash push is the only one which does pathspec\n\n    git stash -h\n    usage: git stash list [<log-options>]\n       ...\n       or: git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]\n                     [-u | --include-untracked] [-a | --all] [(-m | --m\n                     [--pathspec-from-file=<file> [--pathspec-file-nul]\n                     [--] [<pathspec>...]]\n\nand pretty sure it's relative.\n\nSadly, git stash list does not allow a pathspec, despite the\n[<log-options>]. But if you want you can do\n\n    git log stash [<log-options>] [--] [<pathspec>]\n\ninstead, which is handy sometimes.\n"},{"id":"538118","messageId":"xmqqv7f8y6ev.fsf@gitster.g","threadId":"65142","inReplyTo":"aarHnK-oPHlx_hCw@Eriks-MacBook-Pro.local","subject":"Re: Git reference git stash","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-03-06T21:50:00Z","receivedAt":"2026-03-06T21:50:04Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"erik88 <erik88@gmail.com> writes:\n\n> Pretty sure git stash push is the only one which does pathspec\n>\n>     git stash -h\n>     usage: git stash list [<log-options>]\n>        ...\n>        or: git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]\n>                      [-u | --include-untracked] [-a | --all] [(-m | --m\n>                      [--pathspec-from-file=<file> [--pathspec-file-nul]\n>                      [--] [<pathspec>...]]\n>\n> and pretty sure it's relative.\n\nIn a very early days of Git, I suspect there were, but in modern\nversion with \":/\" (or :(top)\" pathspec magic, I do not think of a\nneed for any command (unless it cannot work from anywhere except for\nthe top level of the working tree for some reason) to insist taking\npathspec from the top, not relative to the directory where the user\nis at.  It would break the <TAB>-completion if anything insists that\nthe pathspec must be relative to the top-level.\n\nIt may be a very good exercise (this can be done even by somebody\nrelatively new to the community, I think) to see if anything still\ninsists <pathspec> from the top.  And change the documentation of\nthe pathspec to say \"unless specifically spelled out in each\ncommand's documentation, pathspec elements are taken as relative to\nthe current directory\" or something.\n\n> Sadly, git stash list does not allow a pathspec, despite the\n> [<log-options>]. But if you want you can do\n>\n>     git log stash [<log-options>] [--] [<pathspec>]\n>\n> instead, which is handy sometimes.\n"}]}