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的更多相关文章

  1. Github & DMCA Takedown & git remove history

    Github & DMCA Takedown & git remove history Github & DMCA Takedown Policy Removing files ...

  2. [Practical Git] Remove unnecessary git tracking with .gitignore files

    Most projects have automatically generated files or folders from the operating system, applications, ...

  3. Git CMD - rm: Remove files from the working tree and from the index

    命令格式 git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch] [--quiet] [--] <file>…​ 命令参 ...

  4. GIT使用[git remove untracked working file]

    使用GIT进行merge的时候, git merge --no-ff master 如果merge之后出现问题, 想进行回退, 可以使用 git reset --hard HEAD 来回退到最新的版本 ...

  5. git remove cache

    若在提交.gitignore之前,不小心提交了无用的文件入repo,可以用以下命令在repo中去除这些文件 git rm -r --cached <filename or .> git a ...

  6. Git - Tutorial [Lars Vogel]

    From: http://www.vogella.com/tutorials/Git/article.html Git - Tutorial Lars Vogel Version 5.6 Copyri ...

  7. Git - Tutorial官方【转】

    转自:http://www.vogella.com/tutorials/Git/article.html#git_rename_branch Lars Vogel Version 5.8 Copyri ...

  8. 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 ...

  9. try git

    Git allows groups of people to work on the same documents (often code) at the same time, and without ...

随机推荐

  1. 『LCA 树链剖分』

    LCA Description 给出一个n个节点的有根树(编号为0到n-1,根节点为0).一个点的深度定义为这个节点到根 的距离+1. 设dep[i]表示点i的深度,LCA(i,j)表示i与j的最近公 ...

  2. ASP.NET Core中app.UseDeveloperExceptionPage和app.UseExceptionHandler方法有什么用

    在新建一个ASP.NET Core项目后,在项目Startup类的Configure方法中默认会添加两个方法的调用,app.UseDeveloperExceptionPage和app.UseExcep ...

  3. TServerSocket组件

    主要作为服务器端的套接字管理器使用.它封装了服务器端的套接字.在打开套接字后,服务器端就处于监听状态,在接收到其它机器的连接请求后,与客户端建立连接,创建一个新的套接字,用于和客户端互传数据,此时TS ...

  4. B树索引最通俗易懂的介绍

    先来一段有莫的对话: 前几天下班回到家后正在处理一个白天没解决的bug,厕所突然传来对象的声音:   对象:xx,你有<时间简史>吗?  我:我去!妹子,你这啥癖好啊,我有时间也不会去捡屎 ...

  5. Spring项目中的数据库加密

    有时候为了安全,我们需要对数据库密码进行加密: SpringDruid数据源加密数据库密码 当我们初步开始打造系统时,什么都没有一片空白,而数据源使用的是SpringDruid时,我们可以通过这篇博客 ...

  6. jQuery 前端复选框 全选 反选 下拉菜单联动

    jQuery 页面中复选框全选.反选.下拉联动(级联) <!DOCTYPE html> <html lang="en"> <head> < ...

  7. 英语orientaljasper鸡血石orientaljasper单词

    鸡血石(orientaljasper),是辰砂条带的地开石,因鲜红色似鸡血的辰砂(朱砂)而得名.鸡血石含有辰砂(朱砂).石英.玉髓35%-45%.磁铁矿.赤铁矿6%-12%.辰砂约5%-8%. 鸡血石 ...

  8. mongo数据库的一些命令(对于新同学,按照我的步骤连一遍即可)

    进入mongo mongo 查看数据库 show dbs;/show databases(); 第一个命令简单(admin和local数据库是系统自带的) 进入/创建数据库 use 数据库名字(如果有 ...

  9. APS系统如何让企业实现“多赢”?看高博通信是怎么做的

    高博通信(上海)有限公司凭籍在超精密产业中的技术积累, 强大的资金优势以及与一流大学的联合,使得其正成为国内超精密电子制造行业的领导者. 雄厚的技术实力和专业的团队赢得了波音,空客公司等国际航空器制造 ...

  10. Java abstract关键字 抽象类 抽象方法

    用 abstract 修饰的类是抽象类,它不能生成对象 含有抽象方法的类称为抽象类 抽象方法使用 abstract 修饰 抽象类不能直接实例化,只能由子类实例化 举例 abstract class T ...