gitgitignore

How to open .gitignore file in Git using any text editor installed in your local machine?


I'm taking course on Udemy in Git, The instructor uses Pico texteditor to edit .gitignore file I don't have it installed on my machine (Windows 10)

I'd like to know how to open .gitignore file using locally installed text editor using command line?

This is for Git 2.22.0.windows.1, I tried to open .gitignore file with Visual Studio Code (and wordpad) and got the error;

'Visual' is not recognized as an internal or external command, operable program or batch file.

Here is what I wrote:

VisualStudio Code .gitignore

Solution

  • If you want to open files with Visual Studio Code use command "code":

    code .gitignore 
    

    You can specify path after the filename. Read more here: Opening files via Command Line in VSC

    If this command isn't working, first try this to see if you have "code" command installed:

    code --version
    

    If you get something like:

    -bash: code: command not found

    Then you need to check out this question: How to open Visual Studio Code from the command line on OSX?

    Any text editor should open .gitignore files, but these are hidden files, so you might not see them in your directories. Try opening the directory where you have your git repository installed in VSC and see if .gitignore is listed among other files, simply click it like any other files in VSC to edit them.