Jump To Content

An Introduction To Git

What is Git?

Git is a very well designed and efficient distributed version control system. It was originally created by Linus Torvalds for use on the development of the Linux kernel.

How Does Git Differ From Subversion?

In very many ways, the most fundamental of which is that Git is completely and totally distributed. What this means is that, unlike Subversion, Git does not utilize a single shared repository, every Git instance is it’s own fully-functional independent repository.

Subversion relies on a central repository of which you ‘check-out’ and ‘check-in’ files, Git does not rely on such a methodology. With Git you instead ‘push’ and ‘pull’ changes to and from other repositories.

Since Git is a distributed system the concept of ‘revision’ numbers will not work because commits are decentralized (everyone commits to their own repository remember.) So to get around this Git instead uses a hash of the current state of the repository.

Installing Git

Installation is a snap, as you’d probably expect.


On A Mac (use MacPorts)
$ sudo port install git-core

On Debian
$ apt-get install git

On Winblows
C:\>start iexplorer "http://git.or.cz/gitwiki/CygwinBinaryInstall" 

Using Git

Here is how you would turn an existing directory tree on your machine into a git repository:


> cd path/to/your/project
> git init
> git add .
> git commit

The git init command tells git to initialize this directory tree, git adds a hidden directory that contains history data. The git add . command tells git to add all files and sub-directories in the current directory that we just initialize to the repository. Finally the git commit command tells git to store all current changes to the repository. Notice how none of this involves a server of any kind.

Hui
  • Authority 116
Post Body
Hui said:

Thanks Carsten!

  • Quote
  • Posted 8 months ago.
  • Your comment will be modifiable for 10 minutes after posted.

Page Author

Avatar
Carsten
Name
Carsten

From Here You Can…

Information

  • 627 Views
  • 1 Comment
  • Ratings Likes 3 Negative 0

Most Recent Related Content

Published In…