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

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

 



My $0.02

On Wed, Aug 19, 2009 at 1:52 PM, Rob (gmail)<robvanb@xxxxxxxxx> wrote:
> 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 ?

Thats entirely up to you. I prefer keeping lots of little repositories
for unrelated projects. That way I can use cool things like git
archive to generate tarballs if/when I need to. Although I do use the
single repository method sometimes when I'm feeling lazy. One thing
git has over some other VCSes is the ability to track changes past
renames. That way you can start off lazy and just have a fairly flat
code structure and then as you start to group code into logical sets
you can move them into directories without any danger of losing
history (one tip though, do the moving as a commit on its own this
makes the re-name detection work a lot better).

As Changsheng pointed out. You can also have the best of both worlds
and use git submodules to tie together multiple repositories. Although
I've always though of submodules as more of a build tool when you want
to track components of a larger system i.e. a linux distro might track
the kernel, kde, gnome ... and use a submodule setup to track known
stable points where those components work together.

>
> 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 -u' which adds any locally modified (but not
completely new) files to the index (its basically the first half of
'git commit -a'). For the new files either 'git add .' or list the
files.

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

Yes all the git commands work from subdirectories (well except
init/clone) . This is actually really useful if you want to get the
history of a component in a large code base without getting a lot of
irrelevant changes in other components.
--
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]