简体   繁体   English

停止 git 跟踪临时打开的 Microsoft Office 文件

[英]Stop git from tracking temporary open Microsoft Office files

Microsoft Office makes copies of open files, say when you open abc.xlsx Excel creates a file called ~$abc.xlsx , prefaced with a tilde and dollar sign. Microsoft Office 会复制打开的文件,例如当您打开abc.xlsx Excel 时会创建一个名为~$abc.xlsx的文件,该文件以波浪号和美元符号开头。

When I open an Excel file in my git repository to look at the data, git tracks the new file as a change and I have to take care to avoid committing it.当我在我的 git 存储库中打开 Excel 文件以查看数据时,git 会跟踪新文件作为更改,我必须注意避免提交它。 How can I use a.gitignore file to skip tracking these files?如何使用 .gitignore 文件跳过跟踪这些文件?

Add a new row to your.gitignore file containing ~$* .在包含~$*的 your.gitignore 文件中添加一个新行。 That will ignore any files beginning with ~$ , the prefix for temporary Microsoft Office files.这将忽略任何以~$开头的文件,即临时 Microsoft Office 文件的前缀。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM