git命令--git checkout 之 撤销提交到暂存区的更改
2023-09-27 14:25:06 时间
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 filter-repo
- git config
- git rebase无法处理的问题
- git的经常使用命令
- git命令 add -a和add .和add -u 的区别
- git如何撤销上次提交
- Git命令使用个人总结
- 初学git 2.22.0版本安装详情
- idea 撤回git(已经commit未push的)操作
- Git命令
- 【转】git命令
- Git操作常用概念和命令
- git的一些常见问题
- Jenkins+GitHub报错hudson.plugins.git.GitException: Failed to fetch from GitHub 443
- Git_远程仓库
- Git应用—01初始化项目
- git ------ push(推送) 和 commit(提交) 的区别
- 【软件工具使用】高效使用git工具
- git merge 和 git merge --no-ff
- 让你的Git水平更上一层楼的10个小贴士
- 使用Git和TortoiseGit进行程序版本管理学习笔记
- 《 Git 》__代码管理工具下载和安装的说明(小白也能懂)
- 工作偶然用的GIT命令记录
- git常用的基本命令
- git-分支查看与切换