git stash指定文件
示例:stash单个文件temp.cgit stash push temp.cgit stash -- temp.cgit stash push -m "test" temp.c注意:部分git版本无法stash,我在Windows上面用的git版本是git version 2.10.0.windows.1。这个版本是无法执行上述命令的,在这个版本上,stash的用法如下:usage: git s
文章共341字 · 阅读需要大约2分钟
一键AI生成摘要,助你高效阅读
问答
·
示例:stash单个文件temp.c
git stash push temp.c
git stash -- temp.c
git stash push -m "test" temp.c
注意:部分git版本无法stash,我在Windows上面用的git版本是git version 2.10.0.windows.1。这个版本是无法执行上述命令的,在这个版本上,stash的用法如下:
usage: git stash list [<options>]
or: git stash show [<stash>]
or: git stash drop [-q|--quiet] [<stash>]
or: git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]
or: git stash branch <branchname> [<stash>]
or: git stash [save [--patch] [-k|--[no-]keep-index] [-q|--quiet]
[-u|--include-untracked] [-a|--all] [<message>]]
or: git stash clear
我的服务器上用的git版本是git version 2.17.1,在这个版本上,stash的用法如下:
usage: git stash list [<options>]
or: git stash show [<stash>]
or: git stash drop [-q|--quiet] [<stash>]
or: git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]
or: git stash branch <branchname> [<stash>]
or: git stash save [--patch] [-k|--[no-]keep-index] [-q|--quiet]
[-u|--include-untracked] [-a|--all] [<message>]
or: git stash [push [--patch] [-k|--[no-]keep-index] [-q|--quiet]
[-u|--include-untracked] [-a|--all] [-m <message>]
[-- <pathspec>...]]
or: git stash clear
可以看到前一个版本是没有如下选项的:
or: git stash [push [--patch] [-k|--[no-]keep-index] [-q|--quiet]
[-u|--include-untracked] [-a|--all] [-m <message>]
[-- <pathspec>...]]
而stash特定文件用的是这个命令,因而前一个版本不支持stash单个文件,只能通过其它方式来实现,例如commit之后reset。
更多推荐
已为社区贡献1条内容
所有评论(0)