-2

Im trying to learn git and I'm having serious trouble grokking the most fundamental concept: what exactly -is- a git repository? Or perhaps the more accurate question is what does a git repo actually work with?

Is a git repo the location of a whole bunch of different code projects (e.g. github.com)?

or is a git repo the location of a single code project it's managing? (e.g. github.com/SPICE

Thanks.

joe.smith
  • 11
  • 1
  • From Git's webpage: "Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency." The term "git repository" is the term used for a single git instance - a collection of version-controlled files grouped together in whatever method the user wants. – EEAA Jul 23 '15 at 00:14
  • To make it more clear - github hosts many git repositories. Whether or not any one repository controls one or more code projects is completely up to the user. – EEAA Jul 23 '15 at 00:15
  • A repository is what you are cloning when you issue a command like: `$ git clone https://github.com/foo/bar.git` – EEAA Jul 23 '15 at 00:17
  • The git book is a very good resource to learn git: https://git-scm.com/book/en/v2 – Christophe Drevet Jul 23 '15 at 09:29

1 Answers1

1

A git repository is effectively a data structure for storing files as they change over time. The basic internals of the repo are commits and heads. The commits are basically the code changes being checked in. The heads are pointers to commits. Depending on how changes are being managed it could be a main or a branch (people use differing terminology here).

In terms of the choices you asked in your questions, it's closer to a "single code project", but I'd be careful thinking of it that way. It's probably more accurate to consider it a single codebase. Consider a large project could have many components and you can see why it's not just that a repo is for "PROJECTA". Also, as version change (due to new features), you might have multiple branches pulling from the same repo.

jackhamm
  • 141
  • 8