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

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

 



"Rob (gmail)" <robvanb@xxxxxxxxx> writes:

> 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.

Documentation you might want to read: 

* "Git User's Manual", distributed with Git (installed at least on
  Linux at $sharedir/doc/git-$version/user-manual.html), also at
  http://www.kernel.org/pub/software/scm/git/docs/user-manual.html

* "The Git Community Book", available at
  http://book.git-scm.com/

* "Pro Git.  Professional version control", available at
  http://progit.org/book/

> 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 ?

You should create a new repository for each project.  In git each
commit is about state of whole repository.


If you have single unrelated files, you might want to consider using
Zit tool (see http://git.or.cz/gitwiki/InterfacesFrontendsAndTools for
details), but beware that it is in early stages of development.

(Although if you choose one big repository, you can split it later
with some effort using git-filter-branch (or git-split somewhere in
mailing list archives) if you didn't publish your repositories).
 
> 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 ?

"git add ." would add _all_ new not ignored files, and would stage all
changed files.  But you would have to be sure that all files you don't
want to be comitted, like generated files (*.o, *.log,...) and backup
files of your editor (*~ or *.bak), are ignored using .gitignore
(usually for generated files) and .git/info/excludes or
core.excludesFile (usually for specific patterns like backup files).

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

Most git commands take subdirectory they are in into consideration
when acting.  "git add <filename>" in subdirectory works as expected.

Note that some commands need to have '.' as filename / pattern to be
limited to current subdirectory / act on current directory.

> --
> When in trouble or in doubt, run in circles, scream and shout

:-)

-- 
Jakub Narebski
Poland
ShadeHawk on #git
--
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]