简体   繁体   中英

How can you git stash untracked files with a custom message?

How can I perform git stash --include-untracked with a custom message?

I've tried:

git stash --include-untracked --message "Foo"

and

git stash "Foo" --include-untracked

but both print a usage warning in Git 2.17.1.

The operation you're looking for is git stash push ; in this case you need the subcommand. So you'd write git stash push --include-untracked --message "Foo" .

I recommend creating a branch for this.

If you don't want anybody to see this work, then just don't push it anywhere.

In older versions of git ( < 2.13 ) you need to use the save subcommand:

git stash save --include-untracked "Foo"

In newer version it is recommended to use the push subcommand:

git stash push --include-untracked --message "Foo"

Note: stash save is deprecated in favour of stash push since git version 2.16.0 .

Git 2.7.4

git stash save -u your message here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM