.gitignore for Qt
38 ignore rules for Qt, ready to copy into your repository.
Cross-platform application framework
The complete .gitignore for Qt
# Generated by LFGitignore - https://lfgitignore.com
# Created: 2026-08-05 01:30:34 UTC
# Technologies: Qt
### Qt ###
*.slo
*.lo
# Object file
*.o
# Static library
*.a
*.la
*.lai
# Shared object
*.so
# Versioned shared object
*.so.*
# Dynamic link library
*.dll
# macOS dynamic library
*.dylib
object_script.*.Release
object_script.*.Debug
*_plugin_import.cpp
/.qmake.cache
/.qmake.stash
*.pro.user
*.pro.user.*
*.qbs.user
*.qbs.user.*
*.moc
moc_*.cpp
moc_*.h
qrc_*.cpp
ui_*.h
*.qmlc
*.jsc
Makefile*
*build-*
*.qm
*.prl
target_wrapper.*
*.autosave
*.qmlproject.user
*.qmlproject.user.*
CMakeLists.txt.user*
# Compilation database
compile_commands.json
*creator.user*
*_qmlcache.qrc
What these Qt rules actually ignore
Every pattern below, and why it belongs in your .gitignore.
C++ objects and libs
| Pattern | What it ignores |
|---|---|
*.slo |
C++ objects and libs |
*.lo |
C++ objects and libs |
*.o |
Object file |
*.a |
Static library |
*.la |
C++ objects and libs |
*.lai |
C++ objects and libs |
*.so |
Shared object |
*.so.* |
Versioned shared object |
*.dll |
Dynamic link library |
*.dylib |
macOS dynamic library |
Qt-es
| Pattern | What it ignores |
|---|---|
object_script.*.Release |
Qt-es |
object_script.*.Debug |
Qt-es |
*_plugin_import.cpp |
Qt-es |
/.qmake.cache |
Qt-es |
/.qmake.stash |
Qt-es |
*.pro.user |
Qt-es |
*.pro.user.* |
Qt-es |
*.qbs.user |
Qt-es |
*.qbs.user.* |
Qt-es |
*.moc |
Qt-es |
moc_*.cpp |
Qt-es |
moc_*.h |
Qt-es |
qrc_*.cpp |
Qt-es |
ui_*.h |
Qt-es |
*.qmlc |
Qt-es |
*.jsc |
Qt-es |
Makefile* |
Qt-es |
*build-* |
Qt-es |
*.qm |
Qt-es |
*.prl |
Qt-es |
Qt unit tests
| Pattern | What it ignores |
|---|---|
target_wrapper.* |
Qt unit tests |
QtCreator
| Pattern | What it ignores |
|---|---|
*.autosave |
QtCreator |
QtCreator Qml
| Pattern | What it ignores |
|---|---|
*.qmlproject.user |
QtCreator Qml |
*.qmlproject.user.* |
QtCreator Qml |
QtCreator CMake
| Pattern | What it ignores |
|---|---|
CMakeLists.txt.user* |
QtCreator CMake |
QtCreator 4.8< compilation database
| Pattern | What it ignores |
|---|---|
compile_commands.json |
Compilation database |
QtCreator local machine specific files for imported projects
| Pattern | What it ignores |
|---|---|
*creator.user* |
QtCreator local machine specific files for imported projects |
*_qmlcache.qrc |
QtCreator local machine specific files for imported projects |
How to use this .gitignore for Qt
- Copy the Qt rules above, or download the file directly.
- Create a file named .gitignore at the root of your Git repository and paste the rules into it.
- If some of those files are already tracked, run git rm -r --cached . then commit again — Git only applies ignore rules to untracked files.
- Commit the .gitignore so everyone on the team shares the same rules.