Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Introduction to Git GitHub and Other Remote Repositories Summary

Kevin Huang
Kevin Huang
5,806 Points

PLEASE HELP... If I already git init a parent folder, do I need to git init every new project I created in sub folders?

As an example,

  1. I "git init" at folder home/python projects
  2. I create sveral python projects, like home/python projects/py1, home/python projects/py2 My question is do I need "git init" in every sub folder or not?

1 Answer

Michael Hulet
Michael Hulet
47,913 Points

It depends on what you wanna do. Running git init tells git "everything in this folder and all its subfolders constitute a single project I wanna track". If you have a project in home/python/myapp and another one in home/python/anotherapp, it'd make sense to git init in both of those directories because they're both their own distinct project. You could also have a git repository in home/python that will also track both of those projects in one repository, but that doesn't really make much sense to do imo. All in all, a git repository is meant to track a single project at a time, so wherever you have the root of a project on your system, that's where you should run git init

Kevin Huang
Kevin Huang
5,806 Points

thanks a lot for understanding git init just for one project