git ignore - HollyPony/git-documentation GitHub Wiki
How to hide files on Git.
Table of contents:
- Ignore files project
- Ignore files project only for the user
- Ignore files for all user project (git --global way)
- Ignore a file already commit / push
- Test ignored files
- Sources
Create a .gitignore file in $PROJECT_PATH then list the excluded paths
Note: .gitignore file can be nested and will be applied only on subfolders (relatively)
This .gitignore is named exclude and located at: $PROJECT_PATH/.git/info/exclude
This file will not appear in git status, it's a ghost.
This Gitignore file should be defined in the global git config located at ~/.gitconfig (maybe empty)
Retrieve the Gitignore file: git config --global core.excludesfile
Define the Gitignore file: git config --global core.excludesfile ~/.gitignore (path and name of ~/.gitignore is editable)
Note: Syntax of .gitconfig file
# [core]
# excludesfile = /path/to/user/home/.gitignore
git rm fileToIgnore.cobol- Add
fileToIgnore.cobolto.gitignore - Commit / Push
If the file is still here (in staged changes): git rm --cached fileToIgnore.cobol
TODO