2

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
4
  • 1
    Notepad, Atom, notepad++ or any other text editor should open .gitignore. Commented Jun 22, 2019 at 13:16
  • 1
    If you use linux then vi, vim, emacs or nano editor should work. Commented Jun 22, 2019 at 13:17
  • 1
    Possible duplicate of How to call VS Code Editor from command line Commented Jun 22, 2019 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. Commented Jun 22, 2019 at 13:45

3 Answers 3

5

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

1

% open .gitignore

This opens the gitignore file with the default text editor.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.