SYJ@WIN-95I6OG3AT1N /D/gitlab/ihr-kafka-produce (master)
$ git status 【由于工作区文件被修改了,所以显示为红色】
On branch master
Your branch is up-to-date with 'origin/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: ihr-producer/src/main/resources/spring/applicationContext-producer.xml no changes added to commit (use "git add" and/or "git commit -a") SYJ@WIN-95I6OG3AT1N /D/gitlab/ihr-kafka-produce (master)
$ git add . SYJ@WIN-95I6OG3AT1N /D/gitlab/ihr-kafka-produce (master)
$ git status 【由于文件被添加到了暂存区,等待提交,所以显示为绿色】
On branch master
Your branch is up-to-date with 'origin/master'. Changes to be committed:
(use "git reset HEAD <file>..." to unstage) modified: ihr-producer/src/main/resources/spring/applicationContext-producer.xml SYJ@WIN-95I6OG3AT1N /D/gitlab/ihr-kafka-produce (master)
$ git reset HEAD .
Unstaged changes after reset:
M ihr-producer/src/main/resources/spring/applicationContext-producer.xml SYJ@WIN-95I6OG3AT1N /D/gitlab/ihr-kafka-produce (master)
$ git status 【由于使用"git reset HEAD ."又撤销了前面所做的所有的add操作,所以这里又恢复到红色】
On branch master
Your branch is up-to-date with 'origin/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: ihr-producer/src/main/resources/spring/applicationContext-producer.xml no changes added to commit (use "git add" and/or "git commit -a") SYJ@WIN-95I6OG3AT1N /D/gitlab/ihr-kafka-produce (master)
$ git checkout . 【撤销对工作区所做的一切更改,这样以前所有的修改就都没有,慎用!】 SYJ@WIN-95I6OG3AT1N /D/gitlab/ihr-kafka-produce (master)
$ git status
On branch master
Your branch is up-to-date with 'origin/master'. nothing to commit, working directory clean SYJ@WIN-95I6OG3AT1N /D/gitlab/ihr-kafka-produce (master)
$

如果觉得本文对您有帮助,不妨扫描下方微信二维码打赏点,您的鼓励是我前进最大的动力:

git命令--git checkout 之 撤销提交到暂存区的更改的更多相关文章

  1. Git入门 时光穿梭鸡 版本回退 工作区 暂存区

    分布式集中式 CVS及SVN都是集中式的版本控制系统 , 而Git是分布式版本控制系统 集中式版本控制系统,版本库是集中存放在中央服务器的, 而干活的时候,用的都是自己的电脑,所以要先从中央服务器取得 ...

  2. git使用记录七:对工作区和暂存区的一些操作场景

    比较暂存区和HEAD所含文件的差异? 操作场景如下: 修改readme.md 文档 vi readme.md 加入到暂存区域 git add readme.md 使用git diff -cached ...

  3. Git使用指南(2)——工作区,暂存区,版本库

    1 工作区修改添加到暂存区 git add 2 暂存区提交到版本库 git commit 3 版本库更新到暂存区 git reset HEAD 4 删除暂存区文件 git rm --cached< ...

  4. Git使用详细教程(1):工作区、暂存区、本地仓库、远程仓库

    之前的写过一篇如何在服务器上搭建Git服务Git服务器搭建,接下来的一段时间,我将详细的讲解Git的使用.看如下一张图片,本篇主要理解一些基本概念. 图中几个名词的意思如下: workspace: 工 ...

  5. git(工作区,暂存区,管理修改,撤销修改,删除文件)

    工作区和暂存区 984次阅读 Git和其他版本控制系统如SVN的一个不同之处就是有暂存区的概念. 先来看名词解释. 工作区(Working Directory) 就是你在电脑里能看到的目录,比如我的l ...

  6. Git - 暂存区及撤销修改

    1. 暂存区 每个 Git 仓库中,都有一个隐藏目录 .git 用于存放 Git 仓库的相关信息,包括暂存区(称为 stage).自动创建的 master 分支以及指向 master 分支的 HEAD ...

  7. git命令——git rm、git mv

    git rm git rm命令官方解释 删除的本质 在git中删除一个文件,本质上是从tracked files中移除对这些文件的跟踪.更具体地说,就是将这些文件从staging area移除.然后c ...

  8. git命令——git status、git diff

    前言 当对项目做了更改时,我们通常需要知道具体改了哪些文件,哪些文件更改了没有暂存,哪些文件改了并且已加入到暂存区等待下次commit.上述任务使用git status都可以帮我们解决.但是想要知道文 ...

  9. git 命令 git status add rm commit mv

    1.查看 git 仓库文件改动状态 Git 仓库内文件改动有 4 种状态,除了 Unmodified 状态的文件因为并未改动默认没有状态不做显示之外,其他文件改动状态都可以通过 git status ...

随机推荐

  1. ios中UIWebview和asiHttprequest的用法

    原文地址为:http://www.cnblogs.com/pengyingh/articles/2343062.htmlasiHttprequest的用法 它对Get请求的响应数据进行缓存(被缓存的数 ...

  2. HDU 1556 Color the ball (数状数组)

    Color the ball Time Limit: 9000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)To ...

  3. 【java】详解JFrame结构的分层

    在这篇博文中,笔者会介绍JFrame窗口的分层.JFrame继承自Frame,同JFrame.JDialog.JApplet都是重量级组件.如果不弄清楚Frame的分层结构,那么在设置组件的某些特效的 ...

  4. 在Linux CentOS 6.6上安装RedisLive

    Real time dashboard for redis 安装必须软件 1.安装pip到指定的python版本下面: curl -O https://bootstrap.pypa.io/get-pi ...

  5. Swift 封装

    前言 封装主要有两大目的:一是为了我们使用数据更加方便,二是为了数据保护. 1.Swift 访问修饰符 在 Swift 语言中,访问修饰符也分为三类,分别是 private.internal.publ ...

  6. GitHub Desktop 代码库管理工具

    1.GitHub Desktop 简介 GitHub Desktop 是用于 GitHub 项目版本控制软件. 官网下载地址 GitHub Desktop 其它下载地址 GitHub Desktop ...

  7. 【C语言】字符串与整型数值之间的转换

    一.将字符串转化为对应的数值 /*============================================================================= # # F ...

  8. SharePoint 2013 Step by Step—— How to Upload Multiple Documents in Document Library

    How to Upload Multiple documents in SharePoint 2013,Options to add multiple files in a document libr ...

  9. 神经网络写诗(charRNN)

    https://github.com/chenyuntc/pytorch-book 基于pytorch ,许多有趣的小应用.感谢作者! 作者的代码写得非常清晰,配置方法也很明确,只需要按照提示,安装依 ...

  10. 使用 properties 配置文件装配 bean 的方式

    在spring中将bean 注册到spring 容器中常见的有三种方式(两类): 先说明配置文件内容:application.yml,有一段配置如下 persons: youtube: name: y ...