[Git] Remove Files from Staging Before Committing
If you've added files to the staging area (the Index) accidentally - you can remove them using git reset.
We'll first add a file to staging, but then back it out with:
git reset HEAD filename
in order to pull it back to the working directory, so it doesn't end up in a commit when we don't want it to.
You created a new file lib.js
You have add to stating area.
git status
git add .
But later you find out that you don't want to add lib.js
git log --oneline

Run:
git reset HEAD lib.js
It will untrack lib.js file.

[Git] Remove Files from Staging Before Committing的更多相关文章
- Github & DMCA Takedown & git remove history
Github & DMCA Takedown & git remove history Github & DMCA Takedown Policy Removing files ...
- [Practical Git] Remove unnecessary git tracking with .gitignore files
Most projects have automatically generated files or folders from the operating system, applications, ...
- Git CMD - rm: Remove files from the working tree and from the index
命令格式 git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch] [--quiet] [--] <file>… 命令参 ...
- GIT使用[git remove untracked working file]
使用GIT进行merge的时候, git merge --no-ff master 如果merge之后出现问题, 想进行回退, 可以使用 git reset --hard HEAD 来回退到最新的版本 ...
- git remove cache
若在提交.gitignore之前,不小心提交了无用的文件入repo,可以用以下命令在repo中去除这些文件 git rm -r --cached <filename or .> git a ...
- Git - Tutorial [Lars Vogel]
From: http://www.vogella.com/tutorials/Git/article.html Git - Tutorial Lars Vogel Version 5.6 Copyri ...
- Git - Tutorial官方【转】
转自:http://www.vogella.com/tutorials/Git/article.html#git_rename_branch Lars Vogel Version 5.8 Copyri ...
- How to get started with GIT and work with GIT Remote Repo
https://www.ntu.edu.sg/home/ehchua/programming/howto/Git_HowTo.html#zz-7. 1. Introduction GIT is a ...
- try git
Git allows groups of people to work on the same documents (often code) at the same time, and without ...
随机推荐
- Mysql 8.0版本开始,不允许创建 MyISAM 分区表
从MySQL 8.0版本开始,就不允许创建 MyISAM 分区表了,只允许创建已经实现了本地分区策略的引擎. 到目前为止,只有InnoDB和NDB这两个引擎支持本地分区策略. [1]实际测试 (1)数 ...
- stm32 普通IO口模拟串口通信
普通IO口模拟串口通信 串口通信协议 串口传输 默认 波特率9600 1起始位 1停止位 其他0 数据位是8位(注意图上的给错了). 传输时,从起始位开始,从一个数据的低位(LSB)开始发送,如图从左 ...
- Linux VIM8.1 Python3 编辑器配置文件
Linux VIM8.1 Python3 编辑器配置文件 实现功能: 自动补全(包括函数模块方法补全) 自动代码标准格式化 自动检查代码错误 自定义头文件 自动括号补全 缩进指示线 代码一键折叠 代码 ...
- Java Objective-C AOP
Java Use an AOP library or byte-code engineering (BCEL, cglib, asm, etc) to create a sub-class on th ...
- java 基础 四种权限修饰符
/** * Java有四种权限修饰符: * public > protected > (default) > private * 同一个类 YES YES YES YES * 同一个 ...
- Linux图形界面从登录列表中隐藏用户和开机自动登录
从GDM-GNOME显示管理器:“ GNOME显示管理器(GDM)是一个管理图形显示服务器并处理图形用户登录的程序.” 显示管理器为X Window System和Wayland用户提供图形登录提示. ...
- C#读写设置修改调整UVC摄像头画面-倾斜
有时,我们需要在C#代码中对摄像头的倾斜进行读和写,并立即生效.如何实现呢? 建立基于SharpCamera的项目 首先,请根据之前的一篇博文 点击这里 中的说明,建立基于SharpCamera的摄像 ...
- 一张图看懂SharpCamera
通过下面的图片,可以瞬间看懂整个类库的脉络.
- sql server 根据字段去重
使用 row_number() over (partition by 要去重的字段 order by 排序字段) 数据库表结构 学生成绩表 UserGrade Id int ...
- Kubeadm 1.9 HA 高可用集群本地离线镜像部署【已验证】
k8s介绍 k8s 发展速度很快,目前很多大的公司容器集群都基于该项目,如京东,腾讯,滴滴,瓜子二手车,易宝支付,北森等等. kubernetes1.9版本发布2017年12月15日,每三个月一个迭代 ...