git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git stash path/to/only/one/subdirectory

From
PDPatrick Doyle <wpdster@gmail.com>
Date
Dec 8, 2010, 14:15 UTC
Message-ID
<AANLkTim+sOeVfkAac1v-CsD5GG8Vj2VSjXn-9SSw+Hjb@mail.gmail.com>

Looking at the man page for git-stash, it seems like I can do this with the --patch option to git-stash, but I figured I'd ask the questions anyway...

Is it possible to git-stash a single directory, while leaving the rest of my working copy in the state it's in?

In my particular case (as of 9:00am this morning), I've realized that I want to split my work into 2 separate commits; I'm not done with either of them yet; and they are in completely separate directories from each other. I would like to do something like:

$ git stash --subdir-only dir1 edit/test stuff in dir2, possibly committing once or twice along the way $ git commit dir2 go off and do other stuff for a while, and come back to the dir1 stuff I was playing with $ git stash pop finish the dir1 work $ git commit dir1

If this capability doesn't exist, I could try adding it... would other folks see this as useful?

--wpd
Next: Johan Herland
Message 1 of 2 in “git stash path/to/only/one/subdirectory”
  1. Patrick DoyleDec 8, 2010
  2. Johan HerlandDec 8, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.