2

I am relatively new to Git. I created a new local repository, in my Windows machine, by issuing git init command (say, inside d:\testproj folder). i then configured Eclipse (my java ide) to point to this directory and started working on it. i then executed "git add" and "git commit" commands from the testproj folder. All commands executed successfully.

My question is: Is testproj the working tree or git local repository?

PS: Meanwhile, i was looking for answers in stackoverflow and found this: https://stackoverflow.com/a/5283457/291475. I then came to a conclusion that .git directory is the local repository and testproj is the working directory. Is that correct?

Thank you.

Community
  • 1
  • 1
navr
  • 72
  • 5

1 Answers1

0

Yes, that is correct. The .git directory contains everything that makes it a git repo. And it's where the history (commits) of your working tree (in this case, testproj) is kept. Deleting it would essentially remove the git out of that directory.

Anshul Goyal
  • 73,278
  • 37
  • 149
  • 186
Eduardo Bautista
  • 1,340
  • 2
  • 10
  • 22
  • 1
    Sorry. I wasn't clear with your answer. Did you say that .git is local repo and testproj is working tree? – navr Feb 06 '14 at 15:56
  • Another related question. If i need to setup a project that spans multiple repositories, how do i do it? – navr Feb 06 '14 at 18:05
  • You could setup a git repository with git submodules: http://git-scm.com/docs/git-submodule – Eduardo Bautista Feb 06 '14 at 19:01
  • git submodules are considered sub optimal, consider instead https://github.com/apenwarr/git-subtree Read here for a more in-depth of why: http://uttamkini.com/2012/12/01/sharing-code-and-why-git-submodules-is-a-bad-idea/ – Yeti Feb 06 '14 at 22:05