Rename gitignore.txt to .gitignore

4

I created a gitignore file in Windows so that some unnecessary files will not be uploaded to GitHub. However, this file has the extension ".txt" ( gitignore.txt ). I want to leave it only as .gitignore .

How can I do this? Is there any way I can rename it from the command line?

    
asked by anonymous 29.03.2016 / 15:25

3 answers

5

Through explorer it is not possible to rename a file so that it has only extension, it is considered as having no name, which is not allowed.

The solution is to open a command window and use the command rename :

  • In explorer open the folder where the file is.
  • In the menu displayed choose the option "Open command window here"
  • In the window that opened, type the command rename gitignore.txt .gitignore
  • Type enter .
29.03.2016 / 15:34
1

At the command line type:

ren .gitignore.txt .gitignore

To access the command line from the current folder go to the address bar and type cmd .

Via explorer just press F2 and remove the extension.

    
29.03.2016 / 15:35
1

You can open your file in Notepad and use the save as. In the save window select tipo de arquivo as todos(*) and remove the .txt from the extension.

Or from the command line go to the folder of your file and use:

rename .gitignore.txt .gitignore
    
29.03.2016 / 15:36