1

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
Yusuf al-Imrani
  • 55
  • 1
  • 2
  • 9
  • 1
    Notepad, Atom, notepad++ or any other text editor should open .gitignore. – mchawre Jun 22 '19 at 13:16
  • 1
    If you use linux then vi, vim, emacs or nano editor should work. – mchawre Jun 22 '19 at 13:17
  • 1
    Possible duplicate of [How to call VS Code Editor from command line](https://stackoverflow.com/questions/29963617/how-to-call-vs-code-editor-from-command-line) – Joe Jun 22 '19 at 13:37
  • 1
    You might want to install git bash. It comes with a whole bunch of Linux utilities including vim as a default got editor. – Dr Phil Jun 22 '19 at 13:45

3 Answers3

4

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.

Roirraw
  • 93
  • 7
1

You can use every text editor installed on your system. Consider the.gitignore file as a simple text file.

Stefano Maglione
  • 3,946
  • 11
  • 49
  • 96
1

% open .gitignore

This opens the gitignore file in the default text editor.

turingtested
  • 6,356
  • 7
  • 32
  • 47