.gitignore for Fortran

38 ignore rules for Fortran, ready to copy into your repository.

General-purpose programming language

The complete .gitignore for Fortran

# Generated by LFGitignore - https://lfgitignore.com
# Created: 2026-09-17 16:58:14 UTC
# Technologies: Fortran

### Fortran ###
*.d
# Backup file
*.bak
*.slo
*.lo
# Object file
*.o
# Object file
*.obj
*.gch
*.pch
*.ilk
# Program debug database
*.pdb
# Shared object
*.so
# macOS dynamic library
*.dylib
# Dynamic link library
*.dll
*.mod
# Versioned shared object
*.so.*
*.smod
# Temporary files
*.tmp
*.lai
*.la
# Static library
*.a
# Library file
*.lib
# Windows executable
*.exe
# Compiler output
*.out
# Application bundle
*.app
# Build output directory
build/
build-*/
CMakeFiles/
# CMake cache
CMakeCache.txt
# CMake install script
cmake_install.cmake
# Generated makefile
Makefile
# CMake install manifest
install_manifest.txt
# Compilation database
compile_commands.json
# Log file
*.log
# Vim swap file
*.swp
vcpkg_installed/
*.dwo
Testing/
.cache/

What these Fortran rules actually ignore

Every pattern below, and why it belongs in your .gitignore.

Prerequisites

Pattern What it ignores
*.d Prerequisites

Temporary files

Pattern What it ignores
*.bak Backup file
*.tmp Temporary files
*.log Log file
*.swp Vim swap file
vcpkg_installed/ vcpkg
*.dwo debug information files
Testing/ test output & cache
.cache/ Temporary files

Compiled Object files

Pattern What it ignores
*.slo Compiled Object files
*.lo Compiled Object files
*.o Object file
*.obj Object file

Precompiled Headers

Pattern What it ignores
*.gch Precompiled Headers
*.pch Precompiled Headers

Linker files

Pattern What it ignores
*.ilk Linker files

Debugger Files

Pattern What it ignores
*.pdb Program debug database

Compiled Dynamic libraries

Pattern What it ignores
*.so Shared object
*.dylib macOS dynamic library
*.dll Dynamic link library
*.so.* Versioned shared object

Fortran module files

Pattern What it ignores
*.mod Fortran module files
*.smod Fortran module files

Compiled Static libraries

Pattern What it ignores
*.lai Compiled Static libraries
*.la Compiled Static libraries
*.a Static library
*.lib Library file

Executables

Pattern What it ignores
*.exe Windows executable
*.out Compiler output
*.app Application bundle

Build directories

Pattern What it ignores
build/ Build output directory
build-*/ Build directories

CMake generated files

Pattern What it ignores
CMakeFiles/ CMake generated files
CMakeCache.txt CMake cache
cmake_install.cmake CMake install script
Makefile Generated makefile
install_manifest.txt CMake install manifest
compile_commands.json Compilation database

How to use this .gitignore for Fortran

  1. Copy the Fortran rules above, or download the file directly.
  2. Create a file named .gitignore at the root of your Git repository and paste the rules into it.
  3. If some of those files are already tracked, run git rm -r --cached . then commit again — Git only applies ignore rules to untracked files.
  4. Commit the .gitignore so everyone on the team shares the same rules.

Other Language .gitignore templates

See every Language template