git checkout not discard changes
1. checkout one branch, show status
user@vbox:/mnt/tmp$ git checkout master
Switched to branch 'master'
user@vbox:/mnt/tmp$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: testfile.c
#
no changes added to commit (use "git add" and/or "git commit -a")
2. show diff, turns out no diff
user@vbox:/mnt/tmp$ git diff
user@vbox:/mnt/tmp$
3. checkout modified file, show status, testfile.c doesn't change.
user@vbox:/mnt/tmp$ git checkout -- testfile.c
user@vbox:/mnt/tmp$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: testfile.c
#
no changes added to commit (use "git add" and/or "git commit -a")
4. solution. Don't know why, but this works for me.
user@vbox:/mnt/tmp$ git add testfile.c
user@vbox:/mnt/tmp$ git status
# On branch master
nothing to commit, working directory clean
user@vbox:/mnt/tmp$
git checkout not discard changes的更多相关文章
- git命令--git checkout 之 撤销提交到暂存区的更改
SYJ@WIN-95I6OG3AT1N /D/gitlab/ihr-kafka-produce (master) $ git status [由于工作区文件被修改了,所以显示为红色] On branc ...
- [Git]checkout 指定版本
Task:知道commit号,如何checkout 指定版本 1. 切换到master: git checkout master 2. 下载最新代码: git pull 3. 下载head: git ...
- git分布式版本控制系统权威指南学习笔记(六):git reset、get stash、git checkout总结
文章目录 1. 概述 2. 如何把修改暂存起来,留着以后使用? 2.1 使用场景 2.2 git stash 暂存进度 2.3 查看进度 2.4 恢复进度 3. 如何撤销工作区的修改? 4. 如何把暂 ...
- 代码回滚:git reset、git checkout和git revert区别和联系
git reset.git checkout和git revert是你的Git工具箱中最有用的一些命令.它们都用来撤销代码仓库中的某些更改,而前两个命令不仅可以作用于提交,还可以作用于特定文件. 因为 ...
- 分支合并git checkout adview git merge adview3
分支合并 git checkout adview git merge adview3
- 每天一命令 git checkout
检出 checkout 是git常用命令之一.主要用于创建切换分支,覆盖本地修改等 git checkout 用于显示工作区,暂存区,版本库中文件的区别 git checkout -b branch ...
- git checkout -b 的详细讲解
创建分支: $ git branch mybranch 切换分支: $ git checkout mybranch 创建并切换分支: $ git checkout -b mybranch 更新mast ...
- [译]git checkout
git checkout git checkout提供3种不同的功能: checking out文件, checking out commits, checking out branch. check ...
- git checkout 命令详解
转自:http://www.cnblogs.com/hutaoer/archive/2013/05/07/git_checkout.html?utm_source=tuicool&utm_me ...
随机推荐
- submit和button的区别
两者主要区别在于:submit可以提交表单(form),而button如果不指定onclick等事件处理函数,它是不做任何事情的.注意哦,在页面上<input type="submit ...
- Eclipse : cannot open output file(c++)
之前电脑卡的时候 强制关闭Eclipse,结果打开再次运行的时候却不能输出了:找了网上的原因,是之前那个进程还未关闭 开发环境 Eclipse for C/C++ & MinGW Er ...
- Linux进程栈和线程栈
参考资料: http://blog.csdn.net/xhhjin/article/details/7579145 总结: 1.进程的栈大小是在进程执行的时刻才能指定的,即不是在编译的时候决定 ...
- ptypes中string类的空间分配
问题描述: 在学习ptypes中string类的空间分配时,经常使分配的空间超出实际所需的空间 使用的分配函数是:_alloc函数 注: 在_alloc函数中调用了 ...
- 【BZOJ】【3439】Kpm的MC密码
Trie树/可持久化线段树 神题啊……搞了我一下午= =(其实第233个提交也是我的) 我一开始的思路:这个找kpm串的过程,其实就跟在AC自动机上沿fail倒着往下走是差不多的(看当前是哪些点的后缀 ...
- iNode for linux install
http://wenku.baidu.com/link?url=953T6GZCnaBzwr4YqPFUT4oOyYr4wyOnXlCLO1OUYZkaJWh2fTs634SM7ZpYiTKkpmYX ...
- 数据导出为excel表格
---恢复内容开始--- 方式一: 通过request和response中携带的数据导出表格,导出的结果会将页面中展示的内容全部导出.代码如下: //调出保存框,下载页面所有内容 String fil ...
- Phyre LCUE with YEBIS cause issues about GS
when LCUE enabled in phyreEngine when Yebis integrated and render there are two mainloopdraws in one ...
- myeclipse 反编译插件 jad 安装
1. 准备工作 下载jad.exe文件:http://www.varaneckas.com/sites/default/files/jad/jad158g.win.zip 下载jadeclipse插 ...
- struts2漏洞原理及解决办法
1.原理 Struts2的核心是使用的webwork框架,处理action时通过调用底层的getter/setter方法来处理http的参数,它将每个http参数声明为一个ONGL(这里是ONGL的介 ...