Easy Trick to Create a dotfile in Windows
Posted: 11/17/2023 2:49:13 PMBy: PrintableKanjiEmblem
Times Read: 1,672
Likes: 0 Dislikes: 0
Topic: Windows
It's always been a bit of a pain in Windows to create a dotfile (Like .gitignore, .dockerfile, etc) but I just learned this weird trick that makes it easier:
- In File Explorer, go to the directory where you want to create the file
- Right-click and pick New, then Text Document
- For the name (Say we want to create a .gitignore file), wipe out everything suggested for the filename, including the .txt extension, then give it a name of ".gitignore." (With a dot on BOTH sides of the filename)
- Hit Enter
- You'll get the warning about changing file extensions, click Yes (Or just hit Enter as that's the default)
- Windows will strip the trailing dot, giving you a fresh empty file named .gitignore !!
Rating: (You must be logged in to vote)