git notes main page | gitolite main page | license

IMPORTANT NOTE: although this page has a "gitolite.com" URL, this is not about gitolite. That's just an artifact of "sitaramc.github.com" being translated to "gitolite.com" and so ALL my git related stuff gets carried over. Gitolite documentation has another /gitolite in the URL, so you can tell. My apologies for this confusion.

terminology

1 general VCS terminology

A project is the minimum set of source code (and related files) that need to be kept together to build the software. Example: Linux

A working tree or worktree is the current set of files that are being worked on, tested, etc.

A branch in a project is an active line of development

A feature is a part of a project that is large and complex enough that it’s day-to-day commits would be too noisy to include in the main project. Example: the disk subsystem, the networking subsystem, etc., in Linux

2 git-specific terminology

(By the way, git concepts simplified contains a much more extensive treatment of some of the following concepts, with lots of diagrams to help).

2.1 working tree, repository, bare repository

2.2 commits, SHAs

2.3 parent commits, commit tree

2.4 head, branch, tag

2.5 reachability

2.6 master, HEAD

2.7 index

3 terminology related to being “distributed”

3.1 clone versus checkout

In a distributed VCS, every developer’s workstation has a full copy of the entire repository. It is therefore called a clone – you clone the remote repository, you don’t merely checkout the latest version from it. (Of course, you can have several clones on the same workstation if you wish).

So where does checkout come in? In git, you checkout a branch from your local repo, so this happens after the clone. Remember this is a full repo, so you already have all the branches that the parent repo had when you cloned.

By default, after the clone is done, git will checkout the same branch that was currently checked out in the repository you’re cloning from. However, you can checkout some other branch at any time (and if you’re using git, you will checkout and manage multiple branches on your local repo all the time, otherwise you’re not really using git!)

3.2 accessing remote repositories

Every remote repository (often called just a remote) has a URL associated with it, which tells your (local) git client how to reach it. There are typically 4 kinds of Git URLs:

See ‘man git-clone’ for all the allowed syntaxes for git URLs.

3.3 naming remote repositories

You can refer to, (or fetch from, and push to) more than one remote repo in your clone, giving them all different URLs. After a while it gets inconvenient to use the full URLs in your git fetch and git push commands, so git allows you to give an easy to remember “nickname” for each “remote”. I could, for instance, do this:

git remote add sejal ssh://sitaram@sejal.herlab.ourcompany.com/path/to/repo.git

After this I could refer to the longer URL by the shortname “sejal” in most git commands and it would be the same thing.

(Note: for convenience, a ‘remote’ called ‘origin’ is automatically created when you clone a repo, pointing to the repo you cloned from.)

3.3.1 origin

So now you know what a nickname is, you can understand what “origin” means. “origin” is just the default name given to the remote repository when you do a git clone. So for example, if I do

git clone ssh://sitaram@sejal.herlab.ourcompany.com/path/to/repo.git

then, after the clone completes, git automatically creates a remote with the nickname origin, which points to ssh://sitaram@sejal.herlab.ourcompany.com/path/to/repo.git. It’s just a convenience thing. You can delete that nickname, you can rename it to something else, etc., if you like.