git stash命令使用手册
修改记录压栈保存:
git stash push -u -m "msg" // -u ~ --意思是包含未被跟踪的文件
git stash push -m "msg"
git stash // 保存当前修改到stash@{0},stash缓存站的顶部
git stash save -u "msg"
git stash save -a "msg" // 包含所有文件,如.gitignore...
push 和 save 的区别:
save [-p|--patch] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q|--quiet] [<message>]
This option is deprecated in favour of git stash push. It differs from "stash push" in that it cannot take pathspecs, and any non-option arguments form the message.
push [-p|--patch] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q|--quiet] [-m|--message <message>] [--] [<pathspec>…]
Save your local modifications to a new stash entry and roll them back to HEAD (in the working tree and in the index). The <message> part is optional and gives the description along with the stashed state.
For quickly making a snapshot, you can omit "push". In this mode, non-option arguments are not allowed to prevent a misspelled subcommand from making an unwanted stash entry. The two exceptions to this are stash -p which acts as alias for stash push -p and pathspecs, which are allowed after a double hyphen -- for disambiguation.
https://git-scm.com/docs/git-stash
git stash list // 查看stash列表
1、添加改动到stash
git stash save "messeag"
git stash save -m "messeag"
git stash save -u "messeag"
git stash save -a "messeag"
-a表示all,是不仅仅把新加入的代码文件放入暂存区,还会把用.gitignore忽略的文件放入暂存区。如果想不影响被忽略的文件,那就要用-u,表示untracked files。
2、恢复改动
git stash list查看stash列表,从中选择你想要pop的stash,运行命令
git stash pop stash@{id}
或者
git stash apply stash@{id} 即可
3、删除stash
git stash drop <stash@{id}> 如果不加stash编号,默认的就是删除最新的,也就是编号为0的那个,加编号就是删除指定编号的stash。
git stash clear 是清除所有stash
4、git stash pop 与 git stash apply <stash@{id}> 的区别。
git stash pop stash@{id}命令会在执行后将对应的stash id 从stash list里删除,而 git stash apply stash@{id} 命令则会继续保存stash id
5. 查看指定stash的diff
git stash show
git stash show stash@{id}
补充:
注:[]方括号中内容为可选,[<stash>]里面的stash代表进度的编号形如:stash@{0}, <>尖括号内的必填
git stash 对当前的暂存区和工作区状态进行保存。
git stash list 列出所有保存的进度列表。
git stash pop [--index] [<stash>] 恢复工作进度
git stash apply [--index] [<stash>] 不删除已恢复的进度,其他同git stash pop
git stash drop [<stash>] 删除某一个进度,默认删除最新进度
git stash clear 删除所有进度
git stash branch <branchname> <stash> 基于进度创建分支
refs:
https://git-scm.com/docs/git-stash
git stash命令总结
https://blog.csdn.net/c_z_w/article/details/52862129
progit
https://git-scm.com/book/zh/v2
SYNOPSIS
git stash list [<options>]
git stash show [<stash>]
git stash drop [-q|--quiet] [<stash>]
git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]
git stash branch <branchname> [<stash>]
git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]
[-u|--include-untracked] [-a|--all] [-m|--message <message>]
[--] [<pathspec>…]]
git stash clear
git stash create [<message>]
git stash store [-m|--message <message>] [-q|--quiet] <commit>
git stash命令使用手册的更多相关文章
- git stash命令详解
git stash命令用于将更改储藏在脏工作目录中. 使用语法 git stash list [<options>] git stash show [<stash>] git ...
- 使用git stash命令保存和恢复进度
使用git stash命令保存和恢复进度 git stash 保存当前工作进度,会把暂存区和工作区的改动保存起来.执行完这个命令后,在运行git status命令,就会发现当前是一个干净的工作区,没有 ...
- git stash 命令
摘自: http://blog.csdn.net/longxiaowu/article/details/26815433 关于git stash命令的使用方法网上一大把,我想记录的是我在使用过程中觉得 ...
- git stash命令及提交指定文件
一.git stash命令 常用git stash命令: (1)git stash save "save message" : 执行存储时,添加备注,方便查找,只有git stas ...
- git 命令参考手册 git中文命令参考手册大全
git init # 初始化本地git仓库(创建新仓库)git config --global user.name "xxx" # 配置用户名git config --global ...
- git stash命令
命令:git stash 1.使用git stash 保存当前的工作现场, 那么就可以切换到其他分支进行工作,或者在当前分支上完成其他紧急的工作,比如修订一个bug测试提交. 2.如果一个使用了一个g ...
- Git常用命令参考手册
配置 # 查看全局配置列表 git config -l # 查看局部配置列表 git config --local --list # 查看已设置的全局用户名/邮箱 git config --globa ...
- 每天一命令 git stash
git stash 命令是用于保存当前进度的命令.该命令会保存当前工作区的改动.保存的改动是已经跟踪的文件的改动,对于未跟踪的改动stash是不会保存的. git stash 命令常用于分支切换的 ...
- 关于Git的stash命令
add 添加新文件到 Git 代码仓库的索引中 $ git add filename mv 移动或重命名文件 $ git mv old-filename new-filename rm 从工作目录和 ...
随机推荐
- BZOJ4654 NOI2016国王饮水记(动态规划+三分)
有很多比较显然的性质.首先每个城市(除1外)至多被连通一次,否则没有意义.其次将城市按水位从大到小排序后,用以连通的城市集合是一段前缀,并且不应存在比1城市还小的.然后如果确定了选取的城市集合,每次选 ...
- in packet sniffer
in packet sniffer 来源 https://kb.fortinet.com/kb/microsites/search.do?cmd=displayKC&docType=kc&am ...
- 【bzoj2844】 albus就是要第一个出场
http://www.lydsy.com/JudgeOnline/problem.php?id=2844 (题目链接) 题意 给出${n}$个数,它们可以异或出${n^2}$个数,将这些数从小到大排列 ...
- Oracle 11g DRCP配置与使用
Oracle 11g DRCP配置与使用Oracle 11g推出了驻留连接池(Database Resident Connection Pool)特性,提供了数据库层面上的连接池管理机制,为应对高并发 ...
- 缓存面板获取之前页面选中的数据Objuid的方法
String partUid = request.getParameter("contextInstanceUid"); contextInstanceUid是存在总线总的键名,存 ...
- PDF截取矢量图
PDF截取矢量图 觉得有用的话,欢迎一起讨论相互学习~Follow Me 方法与步骤 下载并安装 Adobe Acrobat X Pro 软件 点击右侧按钮(工具)-页面-裁剪-单击并选择区域-双击实 ...
- vim文本删除方法 Linux
1,先打开某个文件: vim filename 2,转到文件结尾 在命令模式输入 G 3,转到10行 在命令模式输入 10G 4,删除所有内容:先用G 转到文件尾,然后使用下面命令: :1, .d ...
- *p++、(*p)++、*++p、++*p 的区别
int a[5]={1,2,3,4,5};int *p = a; *p++ 先取指针p指向的值(数组第一个元素1),再将指针p自增1: cout << *p++; // 结果为 1 cou ...
- 纯CSS实现表单验证
ladies and 乡亲们,表单验证你在做吗?客户端or服务器端,javascript or jquery,动手写 or 使用插件,今天我们来探索下使用纯css实现表单验证,借以学习css sele ...
- ASP.NET MVC学习(一)之路由篇Route
什么是路由 通过[路由]配置,路由可以规定URL的特殊格式,使其达到特殊效果. 在ASP.NET MVC框架中,通过路由配置URL,使用户的URL请求可以映射到Controller下的action方法 ...