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

Add config option to make "--keep-index" the default for "git stash push"

From
RJRalf Jung <post@ralfj.de>
Date
Oct 22, 2018, 08:11 UTC
Message-ID
<385edc3f-3749-0620-2275-40785b6fbe49@ralfj.de>
Hi all,

I have been repeatedly bitten by the default behavior of `git stash` to stash not just the unstaged but also the staged changes, and then `git stash pop` making all changes unstaged. This means `git stash && git stash pop`, per default, loses information, and when I just spent 10min carefully selecting hunks to be staged that's quite frustrating.

I found that for myself, I usually expect `git stash` to only stash the changes that are not yet staged. So I'd like to configure git such that `--keep-index` is the default. That would also fix the information loss I mentioned above. (By now I am also aware of `git stash pop --index`, but (a) that's not the default either and (b) its documentation indicates it might not always work very well.) However, going over the `git-config` man page, I have not found any way to change the default behavior. Is that possible somehow? And if not, could you consider this a feature request to add such an option?

Kind regards, Ralf

Next: brian m. carlson
Message 1 of 2 in “Add config option to make "--keep-index" the default for "git stash push"”
  1. Ralf JungOct 22, 2018
  2. brian m. carlsonOct 24, 2018

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.