Getting started with Git for Collaborative Development using Git and GitHub.

Getting Help for Git

Besides just typing your question in your favorite search engine, there are several places right on your command-line that can provide you help with the commands of git.

$ git help             # listing the most important commands
$ git help COMMAND     # man page or local web page
$ git COMMAND --help   # the same

$ git help help        # help about the help system
$ git help --all       # list all the git commands
$ git help tutorial    # a simple git tutorial

Creating a local Git repository

The power of Git comes from two main sources. Its local capabilities and its networking capabalities.

The local capabilities gives you a superb version control tool. The networking capabilities allow you to collaborate with others at ease.

Let's take look at the local capabilities.

As mentioned earlier we are going to use the command line.

Open your terminal. Navigate to a directory where you keep your projects.

For example use a directory called "projects" and inside that directory create a subdirectory for each one of your projects.

On Linux or OSX:

mkdir projects
cd projects
mkdir try-git
cd try-git

On Windows it is almost the same, except that we put the "projects" directory in the root of the c:

cd /c/
mkdir projects
cd projects
mkdir try-git
cd try-git

Initialize git in the current directory

Type in the following command:

git init

The response will be something like this with the full path of the directory on your system.

Initialized empty Git repository in /Users/gabor/projects/try-git/.git/

This command creared a directory called .git (with a leading dot) that contains the "database" of Git. In general you should not change anything in that direcatory manually.

Using the ls command with the appropriate flags we can see that this is the only item in our directory.

$  ls -Al
total 0
drwxr-xr-x  9 gabor  staff  288 Apr  6 18:19 .git

Other articles