xxxxxxxxxx
git stash push -m "custom messsage" --include-untracked
xxxxxxxxxx
You can do it with alias in ~/.gitconfig:
stash-untracked = "!f() { \
git stash; \
git stash -u; \
git stash pop stash@{1}; \
}; f"
And then just do
git stash-untracked
xxxxxxxxxx
$ git statusOn branch mainChanges to be committed: new file: style.cssChanges not staged for commit: modified: index.htmlUntracked files: script.js$ git stash -uSaved working directory and index state WIP on main: 5002d47 our new homepageHEAD is now at 5002d47 our new homepage$ git statusOn branch mainnothing to commit, working tree clean