git status查看文件的状态

提要

通过git status查看文件的状态时,出现了一些如下的提示:

jidfj@DESKTOP-2DAKPIL MINGW64 /g/excise/zhushouProject/ZhuShou (master)
$ git status
On branch master
Your branch is behind 'origin/master' by 8 commits, and can be fast-forwarded.(use "git pull" to update your local branch)Changes not staged for commit:(use "git add <file>..." to update what will be committed)(use "git restore <file>..." to discard changes in working directory)modified:   SceneModule/SceneComponent/layoutListwidget.cppmodified:   ZhuShouMainFrame.pro.userUntracked files:(use "git add <file>..." to include in what will be committed)ZhuShouMainFrame.pro.user.546ac14no changes added to commit (use "git add" and/or "git commit -a")

这时对于新手就不知该如何操作,其实只需根据提示,结合自己的需求,输入指令。

实现

像上面出现的情况,我是在更新了项目之后出现了这样的问题,于是金国一系列的查找终于了解了一些。
支队上面的提示,我想着添加修改到gitlab上,于是我输入了指令:git add 。如下面所示:

dhusd@DESKTOP-2DAKPIL MINGW64 /g/excise/zhushouProject/ZhuShou (master)
$ git add  SceneModule/SceneComponent/layoutListwidget.cppbanli@DESKTOP-2DAKPIL MINGW64 /g/excise/zhushouProject/ZhuShou (master)
$ git pull
error: Your local changes to the following files would be overwritten by merge:SceneModule/SceneComponent/layoutListwidget.cpp
Please commit your changes or stash them before you merge.
error: Your local changes to the following files would be overwritten by merge:ZhuShouMainFrame.pro.user
Please commit your changes or stash them before you merge.
error: The following untracked working tree files would be overwritten by merge:ZhuShouMainFrame.pro.user.546ac14
Please move or remove them before you merge.
Aborting
Updating 77e467a..e1727c0

这时并没有提交更改到暂存区,也就是提交没有结束,若想将修改提交到gitlab上,需要继续输入指令:git commit -a -m “描述”。然后紧接着输入git push指令。才能将修改提交上去。
但是我并不想提交这次修改,所以可以采用下面的指令:
git restore


sdsf@DESKTOP-2DAKPIL MINGW64 /g/excise/zhushouProject/ZhuShou (master)
$ git restore  ZhuShouMainFrame.pro.usersdsf@DESKTOP-2DAKPIL MINGW64 /g/excise/zhushouProject/ZhuShou (master)
$ git pull
error: Your local changes to the following files would be overwritten by merge:SceneModule/SceneComponent/layoutListwidget.cpp
Please commit your changes or stash them before you merge.
error: The following untracked working tree files would be overwritten by merge:ZhuShouMainFrame.pro.user.546ac14
Please move or remove them before you merge.
Aborting
Updating 77e467a..e1727c0sdsf@DESKTOP-2DAKPIL MINGW64 /g/excise/zhushouProject/ZhuShou (master)
$ git status
On branch master
Your branch is behind 'origin/master' by 8 commits, and can be fast-forwarded.(use "git pull" to update your local branch)Changes to be committed:(use "git restore --staged <file>..." to unstage)modified:   SceneModule/SceneComponent/layoutListwidget.cppUntracked files:(use "git add <file>..." to include in what will be committed)ZhuShouMainFrame.pro.user.546ac14

将在工作区但不在暂存区的文件撤销修改,文件的内容恢复到没有修改之前。就是将本地这一次不应该上传已经的文件撤销,但是可以看到还是有一些文件的状态还是不怎么正常。
紧接着执行指令:

sdcs@DESKTOP-2DAKPIL MINGW64 /g/excise/zhushouProject/ZhuShou (master)
$ git add ZhuShouMainFrame.pro.user.546ac14sdcs@DESKTOP-2DAKPIL MINGW64 /g/excise/zhushouProject/ZhuShou (master)
$ git pull
error: Your local changes to the following files would be overwritten by merge:SceneModule/SceneComponent/layoutListwidget.cpp
Please commit your changes or stash them before you merge.
Aborting
Updating 77e467a..e1727c0sdcs@DESKTOP-2DAKPIL MINGW64 /g/excise/zhushouProject/ZhuShou (master)
$ git status
On branch master
Your branch is behind 'origin/master' by 8 commits, and can be fast-forwarded.(use "git pull" to update your local branch)Changes to be committed:(use "git restore --staged <file>..." to unstage)modified:   SceneModule/SceneComponent/layoutListwidget.cppnew file:   ZhuShouMainFrame.pro.user.546ac14

先将文件ZhuShouMainFrame.pro.user.546ac14合并,之后更新了代码,然后又查看了文件的状态,可以看到还是有文件状态不怎么看着舒服,接着输入下面的指令。

sddi@DESKTOP-2DAKPIL MINGW64 /g/excise/zhushouProject/ZhuShou (master)
$ git restore  --staged SceneModule/SceneComponent/layoutListwidget.cppsddi@DESKTOP-2DAKPIL MINGW64 /g/excise/zhushouProject/ZhuShou (master)
$ git status
On branch master
Your branch is behind 'origin/master' by 8 commits, and can be fast-forwarded.(use "git pull" to update your local branch)Changes to be committed:(use "git restore --staged <file>..." to unstage)new file:   ZhuShouMainFrame.pro.user.546ac14Changes not staged for commit:(use "git add <file>..." to update what will be committed)(use "git restore <file>..." to discard changes in working directory)modified:   SceneModule/SceneComponent/layoutListwidget.cpp

上面的提示指出可以通过忽略本次文件在工作区的更改,于是我就忽略了。输入指令:

sdss@DESKTOP-2DAKPIL MINGW64 /g/excise/zhushouProject/ZhuShou (master)
$ git restore SceneModule/SceneComponent/layoutListwidget.cppsada@DESKTOP-2DAKPIL MINGW64 /g/excise/zhushouProject/ZhuShou (master)
$ git status
On branch master
Your branch is behind 'origin/master' by 8 commits, and can be fast-forwarded.(use "git pull" to update your local branch)Changes to be committed:(use "git restore --staged <file>..." to unstage)new file:   ZhuShouMainFrame.pro.user.546ac14sada@DESKTOP-2DAKPIL MINGW64 /g/excise/zhushouProject/ZhuShou (master)
$ git pull
Updating 77e467a..e1727c0
Fast-forwardDecoderPainter/playwidget.cpp                      |   4 +-LoginManager/LoginManager.cpp                      |  14 +-LoginManager/LoginManager.h                        |   1 +MessageCenter/messagecenter.cpp                    |  12 +-MessageCenter/messagecenter.h                      |   4 +-NetWork/networkclienthttp.cpp                      |   7 +NetWork/networkclienthttp.h                        |   2 +-SIgnalList/listwindows.cpp                         |   4 +-.../qss/psblack/SignalList.css                     |   0SIgnalList/qssFile.qrc                             |   1 +SceneModule/SceneComponent/layoutListwidget.cpp    |   6 +-ScreenPreview/priviewnavigator.cpp                 |  52 ++--ScreenPreview/signalwin.cpp                        |  28 +-SourceControl/controlevent.cpp                     |   1 -TimeLine/mainframe.h                               |   7 +-ZhuShouMainFrame.pro.user                          |  18 +-ZhuShouMainFrame.pro.user.546ac14                  | 337 +++++++++++++++++++++ZhuShouMainFrame.ui                                |  10 +-18 files changed, 430 insertions(+), 78 deletions(-)rename "\351\234\200\350\246\201\346\267\273\345\212\240\345\210\260\350\277\220\350\241\214\347\233\256\345\275\225\347\232\204\346\226\207\344\273\266/SignalList.css" => SIgnalList/qss/psblack/SignalList.css (100%)create mode 100644 ZhuShouMainFrame.pro.user.546ac14sada@DESKTOP-2DAKPIL MINGW64 /g/excise/zhushouProject/ZhuShou (master)
$ git status
On branch master
Your branch is up to date with 'origin/master'.nothing to commit, working tree cleansada@DESKTOP-2DAKPIL MINGW64 /g/excise/zhushouProject/ZhuShou (master)
$ git pull
Already up to date.

经过一顿乱操作,可以看到现在查看代码的状态的时候是正常的状态,看着顺眼了。
作者也是第一次使用gitlab很多不懂,还望指教。

总结

1.git restore
撤销本次在工作区但是没有在暂存区的文件内容的更改。
2.git restore --staged
将暂存区的文件从暂存区撤出,不改变文件的内容。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/524013.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Centos7 Docker镜像操作_入门试炼02

文章目录一、镜像操作常用命令二、镜像基础操作2.1. 删除所有镜像2.2. 列出镜像2.3. 搜索镜像2.4. 拉取镜像2.5. 查看所有镜像2.6. 镜像加速器2.7. 删除指定镜像2.8. 列出所有镜像ID2.9. 删除所有镜像一、镜像操作常用命令 说明命令列出docker下的所有镜像docker images列出所…

虚拟化精华问答 | 如何为虚拟机分配任务?

虚拟化&#xff0c;是指通过虚拟化技术将一台计算机虚拟为多台逻辑计算机。今天就让我们来看看关于虚拟化的精华问答吧。1Q&#xff1a;在一台特定的服务器上&#xff0c;每一个虚拟机是否可以运行任何版本的Windows&#xff1f;A&#xff1a;服务器虚拟化对于你在每一个虚拟机…

Centos7 Docker容器操作_入门试炼03

文章目录一、容器常用命令二、查看容器2.1. 查看正在运行容器2.2. 查看所有的容器&#xff08;启动过的历史容器&#xff09;2.3. 查看最后一次运行的容器2.4. 查看停止的容器三、容器创建和运行3.1. 交互式容器和守护式容器的区别3.2. 目录映射3.3. 交互式容器(不建议使用)3.4…

微软日本将试行“上4休3”制度;苹果专卖店人脸识别误把学生当盗贼;腾讯在泰国推出了当地首个AI云平台……...

关注并标星星CSDN云计算极客头条&#xff1a;速递、最新、绝对有料。这里有企业新动、这里有业界要闻&#xff0c;打起十二分精神&#xff0c;紧跟fashion你可以的&#xff01;每周三次&#xff0c;打卡即read更快、更全了解泛云圈精彩newsgo go go 联想 Z6 Pro&#xff08;图片…

无标题栏窗口的实现拖动,和边的拉伸功能

本文的功能实现&#xff0c;参考了链接&#xff1a;https://blog.csdn.net/Ternence_God/article/details/100150377&#xff0c;图片也是来自其。 引言 创建的程序采用系统窗口&#xff0c;直接可以进行拖动&#xff0c;向八个方向拉伸&#xff0c;一旦设置窗口无标题栏&…

Centos7 Docker 文件拷贝_入门试炼04

前提&#xff1a;容器服务必须启动才可以进行文件拷贝 一、常用命令 需求宿主机某一文件/目录->>容器内部docker cp 需要拷贝的文件或目录 容器名称:容器目录容器内部某一文件/目录->>宿主机docker cp 容器名称:容器内目录/文件 宿主机目录/文件 docker cp 容器名…

数据库之战 | 寻找你心中的数据库漫威英雄

戳蓝字“CSDN云计算”关注我们哦&#xff01;技术头条&#xff1a;干货、简洁、多维全面。更多云计算精华知识尽在眼前&#xff0c;get要点、solve难题&#xff0c;统统不在话下&#xff01;作者&#xff1a;S.L.Cloud转自&#xff1a;京东云开发者社区《复仇者联盟4-终局之战》…

qt中event->globalPos()与pos()

理解 event->globalPos() 事件触发点相对于桌面的位置&#xff1b; pos() 程序相对于桌面左上角的位置&#xff0c;实际是窗口的左上角坐标。 下面是通过图示更加清楚的表明上述的解释&#xff1a; 红点所在处即为窗口左上角的坐标pos()&#xff1b; 若鼠标在程序窗口中点…

Centos7 Docker 目录挂载_入门试炼06

文章目录一、目录挂载格式二、需求实战2.1. 目录挂载2.2. 测试目录挂载_同步文件2.3. 测试目录挂载_同步文件夹一、目录挂载格式 我们可以在创建容器的时候&#xff0c;将宿主机的目录与容器内的目录进行映射&#xff0c;这样我们就可以通过修改宿主机某个目录的文件从而去影响…

git查看之前的提交日志

提要 使用git指令查看当前项目在这之前所有人提交的记录&#xff0c;可以使用tig指令。 在命令行输入&#xff1a;tig,然后回车。 出现之前所有人在此项目下的提交信息。按q键退出。 还可以使用指令git log,然后回车&#xff0c;可以查看当天最近的几次提交记录。退出的时候…

Centos7 Docker查看容器IP地址_入门试炼07

一、查看容器IP地址 1. 查看容器运行的各种数据 docker inspect mycentos32. 查看容器ip docker inspect --format{{.NetworkSettings.IPAddress}} mycentos3获取其他信息&#xff0c;找到获取信息的节点&#xff0c;同理 执行docker inspect mycentos3后的所有内容&#x…

Elastic Jeff Yoshimura:开源正在开启新一轮的创新 | 人物志

戳蓝字“CSDN云计算”关注我们哦&#xff01;人物志&#xff1a;观云、盘点、对话英雄。以云计算风云人物为核心&#xff0c;聚焦个人成长、技术创新、产业发展&#xff0c;还原真实与鲜活&#xff01;“从我们的角度来说&#xff0c;开源正在开启新一轮的创新。”在首次中国举…

qt在窗口的子部件中绘制矩形

引言 在窗口中绘制矩形&#xff0c;只需重写paintEvent()函数&#xff0c;在重回函数中实现绘制矩形便可。但在窗口的某一个子部件中实现绘制矩形&#xff0c;此时就需重写事件过滤函数&#xff0c;在指定的子部件的绘图事件实现绘制矩形。 结构 窗口部件的组成如下图&#…

Centos7 Docker 删除容器_入门试炼08

说明命令删除指定的容器格式docker rm $CONTAINER_ID/NAME删除容器指定容器名称docker rm mycentos3删除容器指定容器iddocker rm 90913daea673 注意&#xff0c;只能删除停止的容器 效果图&#xff1a; #删除所有容器 docker rm docker ps -a -q删除所有容器的原理&#xff…

Spark精华问答:DataFrame与RDD的主要区别在哪?

Apache Spark 是专为大规模数据处理而设计的快速通用的计算引擎。目前的热度已经超过Hadoop,正所谓青出于蓝而胜于蓝&#xff0c;今天我们就来看看关于park 的精华问答吧。1Q&#xff1a;DataFrame是什么?A&#xff1a;DataFrame是一种以RDD为基础的分布式数据集&#xff0c;类…

qt的项目中单个文件加载样式表

引言 编写一个项目后&#xff0c;通过加载样式表来设置项目中的所有控件的样式&#xff0c;我之前习惯的是在main.cpp文件中加载一个样式表&#xff0c;该样式表含有程序中所有控件的样式&#xff0c;也就是整个程序只需要加载一遍样式文件。但是多人开发时&#xff0c;不合理…

Centos7 使用Docker MySQL部署_01

文章目录Docker MySQL部署Docker MySQL部署 #1.拉取mysql镜像 docker pull mysql #2.查看拉取的mysql镜像 docker images#3.创建MySQL容器 docker run -di --name ly_mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD123456 mysql注&#xff1a;-p 代表端口映射&#xff0c;格式为 …

“自带大屏”的便利店,你见过吗?

戳蓝字“CSDN云计算”关注我们哦&#xff01;技术头条&#xff1a;干货、简洁、多维全面。更多云计算精华知识尽在眼前&#xff0c;get要点、solve难题&#xff0c;统统不在话下&#xff01; 平常&#xff0c;便利店倒是见过很多&#xff0c;但是“自带大屏”的便利店&#xf…

Centos7 使用Docker 部署Tomca+mysql+调试联通_02

文章目录一、Tomcat部署1. 拉取tomcat镜像2. 上传cas项目3. 修改cas系统的配置文件4. 创建tomcat容器5. 浏览器测试部署的web应用6. 输入账号密码测试mysql连接7. 访问注销接口测试一、Tomcat部署 1. 拉取tomcat镜像 docker pull tomcat:7-jre7注&#xff1a;拉取tomcat镜像&…

qt创建右键菜单,显示在鼠标点击处

引言 给窗口创建右键菜单&#xff0c;右键的时候&#xff0c;右键菜单出现在鼠标点击处。同时设置右键菜单的样式&#xff0c;右键菜单为圆角&#xff0c;起初设置样式的时候&#xff0c;右键菜单的背景在圆角边缘会出现黑色的方角&#xff0c;不能很好的显示为圆角&#xff0…