2

How do you add hidden files in like .flake8 in git? Git add . does not work and not even adding subdirectories. Gitignore is not the issue. Thanks.

Pyjs
  • 89
  • 2
  • 4

2 Answers2

1

For individual files

git add .hiddenfile

for file groups

git add .hidden*

and if in a subdirectory,

git add directory

will include the hidden files in that directory.

Also see Force git to add dotfiles to repository

Frank Hopkins
  • 639
  • 4
  • 12
1

Nothing fancy, just

git add .flake8

PS. git add . also must work. In what way it doesn't work for you?

phd
  • 82,685
  • 13
  • 120
  • 165
  • 1
    git add . does not add .flake8 and sub directories. I check .gitignore and it is not the issue. I tried git add .flake8 and it does not add .flake8 after checking with git status. – Pyjs Aug 06 '19 at 10:40
  • That's strange. Well, a dot `.` means "the current directory"; check that the current directory is the root of the repo when you run `git add .` – phd Aug 06 '19 at 10:43
  • git rev-parse --show-toplevel verifies I got correct root directory. Same as pwd except pwd does nto add : to c like c: in windows OS. – Pyjs Aug 06 '19 at 10:55
  • Is it the same as `pwd`? – phd Aug 06 '19 at 10:55