How Do You Create Files Without File Extensions like .gitconfig in Windows Explorer?

How Do You Create Files Without File Extensions like .gitconfig in Windows Explorer?

Today I worked with a friend on a small project and he wanted to add a .gitconfig-file. He created a new “New Text Document.txt”-file in Windows Explorer and just renamed it to .gitconfig. But Windows Explorer didn’t accept this:

you-must-type-a-file-name

Now what can you do? My friend fired up a console window and he entered this command:

This command worked and he got the file he wanted. But isn’t this a bit cumbersome? Yes, it is. Because instead of firing up a command window, Windows Explorer allows you to create a file like .gitconfig in a much simpler way.

If you want to have a file like
.gitconfig
all you have to do is to create a file
.gitconfig.
in Windows Explorer. Note the dot at the end of the filename. If you have just a dot at the end, Windows Explorer won’t complain about a missing file extension. And in addition, it will remove that dot at the end when it has accepted the file name. That means a filename “.gitconfig.” will create the file “.gitconfig”.

Try it! It’s pretty cool, pretty simple and straight forward. Happy coding! :)

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *

*