Git 版本管理之git神器处理突发事件
起语:
版权声明: 腾讯课堂->零声学院.
我只是用来方便学习 && 复习!!! 我只是一个学习者, 从来不对我说过的话负责, 大家看到谨慎参考!!!
多个客户端之间的同步
git stash的一些命令
具体操作
$ git status #查看当前的状态
$ git diff #查看做了那些修改
$ git stash #缓存起来
$ git diff #查看哪里做了修改
$ git checkout master #切换到主分之
$ cat main.cpp #查看main.cpp的内容
$ git pull #拉取代码
$ git checkout FT-12345 #切换分支
$ git stash list #
$ git stash show #
$ git diff stash #查看此次做了哪些修改
$ git diff [email protected]{0} #查看做了哪些修改
$ git stash pop #取出缓存区栈顶(即最近一次)的内容, 并且会删除此次pop 内容
$ git diff #有什么不同
$ git stash list #查看缓存里所有存储的修改
$ git stash save “xxxxx” #将工作区的修改保存到缓存区, 且取名为 xxxx
$ git diff #此命令比较的是工作目录(Working tree)和暂存区域快照(index)之间的差异也就是修改之后还没有暂存起来的变化内容。
=============================================================
vim main.cpp
又做了修改,
$ git stash save “xxxxx” #将工作区的修改保存到缓存区, 且命名xxxxx
$ git stash list #查看缓存里所有存储的修改
$ git diff [email protected]{1} #查看差异
$ git diff [email protected]{0} #查看差异
$ git stash apply [email protected]{1} #取出stash里的内容, 1为序号, 但是不会删除[email protected]{1}
$ cat main.cpp #查看main.cpp内容
应用到工作区上, 但是并没有删除
$ git stash list #查看缓存里所有存储的修改
$ git stash pop #取出缓存区栈顶(即最近一次)的内容, 并会删除此次pop的内容
结语:
时间: 2020-08-19