博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
git撤销文件修改_使用Git撤消文件更改
阅读量:2516 次
发布时间:2019-05-11

本文共 1223 字,大约阅读时间需要 4 分钟。

git撤销文件修改

One of my favorite features in modern text editors is their ability to integrate tools to format code upon every save.  When you're working on legacy projects, however, auto-formatting can be a problem; if you open a file that you don't explicitly change, the file may still get modified by the formatter.  This all leads to git status showing a bunch of file modifications that you don't want.

现代文本编辑器中我最喜欢的功能之一是它们能够集成工具以在每次保存时格式化代码。 但是,当您处理旧项目时,自动格式化可能会成为问题。 如果打开的文件没有明确更改,则格式化程序可能仍会对该文件进行修改。 所有这些都会导致git status显示一堆您不需要的文件修改。

To quickly undo file changes with git, execute the following two commands:

要使用git快速撤消文件更改,请执行以下两个命令:

git reset HEAD path/to/file.extgit checkout path/to/file.ext

The second command (checkout) is required or you'll still see the file listed when running git status again.  With both of those executions, you'll no longer see the file listed with git status.

第二个命令( checkout )是必需的,否则当再次运行git status时,您仍然会看到列出的文件。 通过这两个执行,您将不再看到带有git status列出的文件。

git makes version control easy but the two steps needed to essentially revert changes to a file aren't intuitive, thus I thought I would share on this blog.  Happy coding!

git使版本控制变得容易,但是本质上将更改恢复到文件所需的两个步骤并不直观,因此我想我将在此博客上分享。 编码愉快!

翻译自:

git撤销文件修改

转载地址:http://hvvwd.baihongyu.com/

你可能感兴趣的文章
Amazon
查看>>
component-based scene model
查看>>
Echart输出图形
查看>>
hMailServer搭建简单邮件系统
查看>>
从零开始学习jQuery
查看>>
Spring+SpringMVC+MyBatis深入学习及搭建(四)——MyBatis输入映射与输出映射
查看>>
opacity半透明兼容ie8。。。。ie8半透明
查看>>
CDOJ_24 八球胜负
查看>>
Alpha 冲刺 (7/10)
查看>>
一款jQuery打造的具有多功能切换的幻灯片特效
查看>>
SNMP从入门到开发:进阶篇
查看>>
@ServletComponentScan ,@ComponentScan,@Configuration 解析
查看>>
unity3d 射弹基础案例代码分析
查看>>
thinksns 分页数据
查看>>
os模块
查看>>
LINQ to SQL vs. NHibernate
查看>>
基于Angular5和WebAPI的增删改查(一)
查看>>
windows 10 & Office 2016 安装
查看>>
最短路径(SP)问题相关算法与模板
查看>>
js算法之最常用的排序
查看>>