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.

Development Tools

Masood Kamandy
Masood Kamandy
2,990 Points

When I run git init in a folder, is a git repo created within every subfolder also? Or do I need to init in those also?

When I run git init in a folder, is a git repo created within every subfolder also? Or do I need to init in those also?

1 Answer

Kevin S
Kevin S
14,964 Points

Nope! You are all good once you do git init. It basically takes that entire folder (and all of its subdirectories) and turns it into a repository. So if you had a folder called "myproject", and inside that folder you had three other folders, and inside those folders you had two folders and so on, All you would have to do is navigate to that top-level "myproject" directory, and do git init.

Then everything inside of that folder would "be seen by git" meaning that they could be potentially staged and committed to the repository.