I need to stash a set of changes that includes a new file - without deleting ignored directories.
So I tried this:
git add --intent-to-add myNewFile.txt
git stash
The result was:
error: Entry 'myNewFile.txt' not uptodate. Cannot merge.
Cannot save the current worktree state
How can I stash the modified files plus one or more selected new files, but not affect any other files or directories (in particular those in .gitignore
)?
(This is not a duplicate of how can I git stash a specific file? because that question is how to stash a file that has previously been added. My problem is to stash a file that has not yet been added.)