Re: New to Git / Questions about single user / multiple projects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 18 Aug 2009, Rob (gmail) wrote:

> I'm new to git and have some (I think) basic questions that I have not
> been able to find answers to in the documentation.
> It's very possible that these are the result of my lack in
> understanding git / version control, so feel free to point me to
> documentation
> that might contain the answers.
> 
> I'm doing ERP development for my job and various 'hobby' development
> in my spare time.
> I'd like to track/store/ version control the code that I write for
> both work and play.
> I am (currently) working by myself, no need to have multiple
> developers working of the same code.
> 
> Q1:
> Can I create a single repository (project?) for all my code, knowing
> that there are multiple small, unrelated projects. Or should I create
> a new repository for each project ?

It's much easier to have a new repository for each project. There are two 
possible ways to put multiple projects in a single repository: (1) you 
could have each one in a subdirectory, which is bad because each commit 
records the entire tree, so each project would have commits in its history 
that are about other projects; (2) you could have separate branches for 
each project; this is fine, but you only get one working directory per 
repository, so it's awkward because you can only have one of your projects 
checked out at a time.

On the other hand, it's pretty trivial to have lots of repositories, and 
there isn't really any disadvantage to it. In fact, you may want to have 
more repositories than projects at times, if you use the same project for 
multiple purposes and want to extend it in different ways at the same 
time.

> Q2:
> After initalizing my repository, and comitting the 1st batch of code:
> When further working on the code, will the command "git add ." add all
> changed and new files ? Or do I specifically need to list the new
> files ?

You can use "git add .", but be aware that this tends to pick up random 
cruft you've left in the directory.

> Q3: Can I run 'git add x' in any subdirectory, or do I need to issue
> if from the root of the project ?

You can run almost every git command from subdirectories, and it does what 
you'd expect with filenames when you're in a subdirectory. E.g., "git add 
x" while in "a/b/" is like being in the project root and running "git add 
a/b/x"

	-Daniel
*This .sig left intentionally blank*
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]