I'd like to have Git ignore all hidden files and directories. i.e.
.aptitude
.ssh/
.bash_rc
config/.hidden
Is there a simple rule to cover this without specifically adding each entry?
Just add a pattern to .gitignore
.*
!/.gitignore
Edit: Added the .gitignore
file itself (matters if it is not yet commited).
.htaccess
already checked in they keep being followed. gitignore
is only important for new files.
Nov 5, 2011 at 16:35
/.gitignore
and not every .gitignore
file regardless of where it is located? I.e. why not list !.gitignore
(no slash)?
Feb 12, 2020 at 16:08
.gitignore
files in your top-level .gitignore
file. But that choice is up to you.
Feb 13, 2020 at 17:08
.gitignore will only effect files that haven't been 'added' already.
To make new .gitignore entries affect all files
git commit -a -m "Pre .gitignore changes"
git rm -r --cached .
git add .
git commit -a -m "Post .gitignore changes"
git status
should output "nothing to commit (working directory clean)"
`In .git/info/exclude
, add this line:
.*
This will make ignoring all hidden/dot files recursively the default for every repository on the machine. A separate .gitignore
file for every repo is not needed this way.