.gitignore for Emacs

24 ignore rules for Emacs, ready to copy into your repository.

Extensible, customizable text editor

The complete .gitignore for Emacs

# Generated by LFGitignore - https://lfgitignore.com
# Created: 2026-08-05 01:32:05 UTC
# Technologies: Emacs

### Emacs ###
# Emacs backup files
*~
# *\#
\
# Emacs desktop save
/.emacs.desktop
# Emacs desktop lock
/.emacs.desktop.lock
*.elc
# Emacs auto-save list
auto-save-list
# Emacs remote access
tramp
# *
.\
# Emacs org-mode IDs
.org-id-locations
# Emacs org-mode archive
*_archive
# Emacs flymake temp files
*_flymake.*
# Emacs shell history
/eshell/history
# Emacs shell last directory
/eshell/lastdir
# Emacs package archives
/elpa/
*.rel
# Emacs auto-generated files
/auto/
# Emacs Cask dependencies
.cask/
# Distribution directory
dist/
# Emacs flycheck files
flycheck_*.el
/server/
# Emacs projectile project
.projectile
# Emacs directory locals
.dir-locals.el
# Emacs network security
/network-security.data
*.~undo-tree~

What these Emacs rules actually ignore

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

General

Pattern What it ignores
*~ Emacs backup files
\ *\#
/.emacs.desktop Emacs desktop save
/.emacs.desktop.lock Emacs desktop lock
*.elc General
auto-save-list Emacs auto-save list
tramp Emacs remote access
.\ *

Org-mode

Pattern What it ignores
.org-id-locations Emacs org-mode IDs
*_archive Emacs org-mode archive
*_flymake.* Emacs flymake temp files
/eshell/history Emacs shell history
/eshell/lastdir Emacs shell last directory
/elpa/ Emacs package archives
*.rel reftex files

AUCTeX auto folder

Pattern What it ignores
/auto/ Emacs auto-generated files
.cask/ Emacs Cask dependencies
dist/ Distribution directory

Flycheck

Pattern What it ignores
flycheck_*.el Emacs flycheck files
/server/ server auth directory
.projectile Emacs projectile project
.dir-locals.el Emacs directory locals
/network-security.data Emacs network security
*.~undo-tree~ undo-tree

How to use this .gitignore for Emacs

  1. Copy the Emacs 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 Editor .gitignore templates

See every Editor template