Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript npm Basics Managing Packages with NPM Ignore Files and Directories with gitignore

Lyndsay Labrecque
Lyndsay Labrecque
334 Points

How exactly does someone create a .gitignore file?

I can infer it's done in Visual Studio, but no information about this is provided.

2 Answers

Jason Larson
Jason Larson
7,174 Points

I don't normally use a terminal, but I believe the command you're looking for is touch, or more specifically, touch .gitignore.

Jason Larson
Jason Larson
7,174 Points

You can create a new file in VS Code by clicking File --> New File, by pressing CTRL + N (on a PC - it's probably Command + N on a Mac), or by clicking the first icon next to the folder name in the explorer view (it looks like a piece of paper with a plus sign on the bottom right corner). Alternatively, you can just create a new file in the folder in your operating system without using VS Code. If you do this, just be sure that you have the options set to see hidden files and folders, as files that start with a period are hidden by default (at least on a PC).

Thanks Jason! Is there a way to do this in the terminal? I know mkdir is to create a file directory, I feel like there is a way to create an individual (text?) file but I've forgotten it.