Linux command
git-stash 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Stash changes
git stash
Stash with message
git stash push -m "[message]"
List stashes
git stash list
Apply latest stash
git stash apply
Pop latest stash
git stash pop
Apply specific stash
git stash apply stash@{[n]}
Show stash contents
git stash show -p
Drop a stash
git stash drop stash@{[n]}
Clear all stashes
git stash clear
说明
git stash temporarily shelves uncommitted changes so you can work on something else. It saves both staged and unstaged modifications, then reverts the working directory to match HEAD. Use `pop` to restore and remove a stash, or `apply` to restore while keeping it. Stashes are stored as a stack, with the most recent at `stash@{0}`.
参数
- -m, --message _msg_
- Stash message.
- -u, --include-untracked
- Include untracked files.
- -a, --all
- Include ignored files.
- -p, --patch
- Interactive stashing.
FAQ
What is the git-stash command used for?
git stash temporarily shelves uncommitted changes so you can work on something else. It saves both staged and unstaged modifications, then reverts the working directory to match HEAD. Use `pop` to restore and remove a stash, or `apply` to restore while keeping it. Stashes are stored as a stack, with the most recent at `stash@{0}`.
How do I run a basic git-stash example?
Run `git stash` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -m, --message _msg_ do in git-stash?
Stash message.