[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 ...
随机推荐
- python自动化使用 HtmlTestRunner 测试用例描述出现dict() -> new empty dictionary
python自动化使用 HtmlTestRunner 测试用例描述出现dict() -> new empty dictionary这个问题,找了各种资料,发现是ddt.py 的问题 修改了dd ...
- 【Java深入研究】11、深入研究hashmap中的hash算法
一.简介 大家都知道,HashMap中定位到桶的位置 是根据Key的hash值与数组的长度取模来计算的. JDK8中的hash 算法: static final int hash(Object key ...
- Map List Set的区别
Map List Map的主要区别如下: set List 是实现了Collection接口的子接口:Map本身就是一个接口: list数据存放时有序的,允许有重复元素:set数据存放时无序的,不允许 ...
- 给router-link 标签添加事件@click 、@mouseover等无效
需要加上native修饰符. 所以如果在想要在router-link上添加事件的话需要@click.native这样写 所以如果要事件有效的话,改成如下: <router-link v-for= ...
- 爬虫requests库 之爬虫贴吧
首先要观察爬虫的URL规律,爬取一个贴吧所有页的数据,观察点击下一页时URL是如何变化的. 思路: 定义一个类,初始化方法什么都不用管 定义一个run方法,用来实现主要逻辑 3 class Tieba ...
- MYSQL中的时间类型
时间上总共有五中表示方法:它们分别是 time.date.datetime.timestamp和year. time : “hh:mm:ss”格式表示的时间值,格式显示TIME值,但允许使用字符串或 ...
- windows上搭建NFS服务器及客户端 挂载
在Windows相关系统上搭建NFS服务及客户端挂载 有两种方式: 第一种: (Windows Server2008R2等类似企业版这样的版本的Server服务上有自带的NFS服务进行搭建) (特别 ...
- python的异常种类
AttributeError 访问一个对象没有的属性 比如:foo.x 但是foo没有x属性 IOError 输入/输出异常 基本是无法打开文件 ImportError 无法映入模块或包 路径或者名称 ...
- PHP开发环境WAMP(Windows+Apache+MySQL+PHP)搭建
关于PHP开发环境这一块,网上有很多的集成环境可以使用,eg. WampServer,XAMPP,PhpStudy,Appserv ...用起来也很方便(但是我并没有比较过哪个更好用一点),但是呢,比 ...
- Docker11-实战-部署多套环境
目录 创建本地挂载目录 准备一个简单的java web项目 启动Tomcat容器:通过挂载不同的代码目录和运行端口来区分 案例:修改测试环境代码 创建本地挂载目录 在宿主host主机上面创建两个目录, ...