maciekcube
maciekcube

Reputation: 71

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?

Upvotes: 4

Views: 1284

Answers (2)

s1n7ax
s1n7ax

Reputation: 3069

  • * ignores everything
  • !.* except dot files
  • !.*/** except any files inside dot files
*
!.*
!.*/**

Upvotes: 2

phd
phd

Reputation: 94676

Try

*
!/**/
!.*

Ignore everything, unignore all directories, unignore dotfiles.

Upvotes: 2

Related Questions