Skip to content

Git ignore

  • Explicitly tells git which files and folders to ignore
  • Rules are defined in .gitignore

File Statuses

Commit previously ignored files

  • Simply remove it from gitignore and commit it again

Ignore previously committed file

  • Option 1
  • Add ignore rule to .gitignore
  • Delete file from WIP
  • Commit changes
  • Add again previously deleted file
  • Option 2
  • Add ignore rule to .gitignore
  • Delete file only from repo keeping it in WIP git rm --cached filename

Best practices for git ignore