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 从工作目录和 ...
随机推荐
- Ryuji doesn't want to study 2018 徐州赛区网络预赛
题意: 1.区间求 a[l]×L+a[l+1]×(L−1)+⋯+a[r−1]×2+a[r](L is the length of [ l, r ] that equals to r - l + 1) ...
- MT【110】巧设法向量解决距离问题
分析:设面的法向量$n=(x,y,z)$
- 【BZOJ1082】[SCOI2005]栅栏(搜索)
[BZOJ1082][SCOI2005]栅栏(搜索) 题面 BZOJ 洛谷 题解 随便写个爆搜,洛谷上就\(80\)分了.先放爆搜代码: #include<iostream> #inclu ...
- CentOS安装git及使用Gitolite来管理版本库
首先吐槽一下网上的各种教程,大部分都扯蛋,估计都是些所谓的"编辑"在网上瞎抄来的-- 以下内容都是基于CentOS的服务器端,Mac OS X的客户端. 如果是使用的Windows ...
- luogu1081 [NOIp2012]开车旅行 (STL::multiset+倍增)
先用不管什么方法求出来从每个点出发,A走到哪.B走到哪(我写了一个很沙雕的STL) 然后把每个点拆成两个点,分别表示A从这里出发和B从这里出发,然后连边是要A连到B.B连到A.边长就是这次走的路径长度 ...
- Java 泛型类型基础
为什么要使用泛型? 未使用泛型的情况: // 创建列表类 List list = new ArrayList(); // 添加一个类型为 String 的列表元素 list.add("hel ...
- MVC、MVP和MVVM浅谈
MVC是最经典的开发模式之一,最早是后台那边来的,后台前端的复杂度也上来了,MVC的开发模式也带进前端了. MVC: MVC有两个很明显的问题: 1.m层和v层直接打交道,导致这两层耦合度高 2.因为 ...
- SQL记录-PLSQL循环
PL/SQL循环 可能有一种情况,当需要执行的代码块的几个多次.在一般情况下,语句顺序执行:一个函数的第一条语句,首先执行,然后是第二个...等等. 编程语言提供了各种控制结构,允许更多复杂的执行 ...
- SQL记录-PLSQL事务
PL/SQL事务 数据库事务是一个工作的原子单元,其可以由一个或多个相关的SQL语句组成.所谓的原子性就是数据库的修改所带来的构成事务的SQL语句可以集体被提交,即永久到数据库或从数据库中(撤消) ...
- node.js+express,实现RESTful API
node代码如下(exptest.js): var express = require('express'); var bodyParser = require('body-parser'); var ...