Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git - ignore all non-dotfiles

I'm trying to figure out a rule for .gitignore file to only keep track of my dotfiles. I've tried combinations of !.* and !^.* used after * and also [^.]* as advised here. None of those ignored all of the visible, non dotfiles. What am I missing?

like image 714
maciekcube Avatar asked Sep 19 '25 13:09

maciekcube


2 Answers

Try

*
!/**/
!.*

Ignore everything, unignore all directories, unignore dotfiles.

like image 86
phd Avatar answered Sep 21 '25 12:09

phd


  • * ignores everything
  • !.* except dot files
  • !.*/** except any files inside dot files
*
!.*
!.*/**
like image 21
s1n7ax Avatar answered Sep 21 '25 12:09

s1n7ax