git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Packham <judge.packham@gmail.com>
To: "Rob (gmail)" <robvanb@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: New to Git / Questions about single user / multiple projects
Date: Wed, 19 Aug 2009 16:14:14 +1200	[thread overview]
Message-ID: <a038bef50908182114s26d3685r9757fa77b9f41211@mail.gmail.com> (raw)
In-Reply-To: <eafc0afe0908181924x60e5dd23vd37711db880ead84@mail.gmail.com>

My $0.02

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

  reply	other threads:[~2009-08-19  4:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-19  1:52 New to Git / Questions about single user / multiple projects Rob (gmail)
2009-08-19  2:24 ` Changsheng Jiang
2009-08-19  4:14   ` Chris Packham [this message]
2009-08-19  4:00 ` Daniel Barkalow
2009-08-19  7:59 ` Jakub Narebski
2009-08-19 11:00   ` Rob (gmail)
2009-08-19 12:18     ` Jakub Narebski
2009-08-19 12:28       ` Rob (gmail)
2009-08-19 12:49         ` Jeff King
2009-08-19 12:48       ` Jeff King
2009-08-19 13:20         ` Jakub Narebski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a038bef50908182114s26d3685r9757fa77b9f41211@mail.gmail.com \
    --to=judge.packham@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=robvanb@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).