git 我应该在 QT 项目中使用什么 .gitignore?(QT 创作者)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2815553/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 04:16:16  来源:igfitidea点击:

What .gitignore I should use with QT projects? (QT Creator)

gitqtqt-creatorgitignore

提问by Envek

So, after little thinking I have wrote the following:

所以,经过深思熟虑,我写了以下内容:

# In repository we don't need to have:
# Compiled object files
*.o

# Generated MOC, resource and UI files
moc_*.cpp
qrc_*.cpp
ui_*.h

# Debug and Release directories (created under Windows, not Linux)
Debug/
Release/

# .log files (usually created by QtTest - thanks to VestniK)
*.log

# Built windows .exe and linux binaries
# NOTE: PROJECT is a your project's name, analog of PROJECT.exe in Linux
*.exe
*.dll
PROJECT

# Windows-specific files
Thumbs.db
desktop.ini
# Mac-specific things (thanks to Michael Aaron Safyan)
.DS_Store

# Editors temporary files 
*~

Please ask, what needs to be added or fixed (especially for Windows - I haven't one under hand now. And Mac too [haven't work in it at all]).

请询问,需要添加或修复什么(特别是对于 Windows - 我现在手头没有一个。Mac 也是 [根本没有在其中工作])。

I want to keep my repository clear :-)

我想保持我的存储库清晰:-)

UPD: Should I include Makefileand Makefile.*in it? *.pro.user?

UPD:我应该包括MakefileMakefile.*在其中吗?*.pro.user?

回答by iamantony

You might be interested in this little project: https://github.com/github/gitignore

你可能对这个小项目感兴趣:https: //github.com/github/gitignore

There you can find .gitignore files for several programming languages, OSs and even more.

在那里,您可以找到多种编程语言、操作系统等的 .gitignore 文件。

回答by Tobias Hunger

The .pro.user file should go into .gitignore. It is not meant to be shared between developers and/or platforms.

.pro.user 文件应该进入 .gitignore。它不打算在开发人员和/或平台之间共享。

I would further add any file that is generated by the build step: This does of course include the Makefiles.

我会进一步添加由构建步骤生成的任何文件:这当然包括 Makefiles。

回答by Michael Aaron Safyan

Some additional things you might want to throw in are ".DS_Store" (created by Finder in Mac OS X -- it does pretty much the same thing as "Thumbs.db" on Windows) and "*.bak" (a common extension for temporary backup files, predominantly found among editors on Linux). You may also be interested in this article on cvs ignorewhich provides a fairly large list of common file patterns to ignore.

您可能想要添加的一些其他内容是“.DS_Store”(由 Mac OS X 中的 Finder 创建——它与 Windows 上的“Thumbs.db”几乎相同)和“*.bak”(一个常见的扩展名)用于临时备份文件,主要在 Linux 上的编辑器中找到)。您可能还对这篇关于 cvs ignore 的文章感兴趣,它提供了一个相当大的要忽略的常见文件模式列表。

回答by VestniK

Starting from Qt 4.6 I have added *.log to my svn:ignore since when I'm running tests which are built with QtTest library they produce such files.

从 Qt 4.6 开始,我将 *.log 添加到我的 svn:ignore 中,因为当我运行使用 QtTest 库构建的测试时,它们会生成此类文件。