What is a Git repository?

Git is a free, open source distributed version control system (DVCS) designed to handle everything from small to very large projects with speed and efficiency.

In addition to working as a DVCS, Git also acts as a local repository, a place where the complete history of your work is stored. When you use Git, your file history is stored in a .git subdirectory of your working copy, so you can work with your full revision history without requiring connection to a central server.

This article will serve as an introduction to what a Git Repository is all about.

What is Git?

Git is a distributed version control system. It originated from Linux kernel development, and is used by many popular open source projects, such as the Android or the Eclipse development teams, as well as many commercial organizations. The core of Git was originally written in the programming language C, but Git has also been re-implemented in other languages, such as Java, Ruby, and Python, although the main development continues in C.

Getting a Git Repository

There are two main approaches to a Git project:

  1. Take an existing project or directory and import it into Git.
  2. Clone an existing Git repository from another server.

After cloning or creating a repository, the user will have a complete copy of the repository. He can then perform version control operations against this local repository. If he so chooses, he can configure the repository as a bare or a non-bare variant.

Bare repositories are only used on servers to share changes coming from different developers, and contain no local changes. Non-bare repositories let you make changes via the modification of your working copy files. This also allows you to create new versions in the repository.

If you want to delete a Git repository, you can simply delete the folder which contains the repository.

Git also allows the user to synchronize the local repository with other remote repositories. Users with sufficient authorization can push changes from their local repository to remote repositories. They can also fetch or pull changes from other repositories and bring these changes to their local Git repository.

Git supports branching, which means that you can work on different versions of your collection of files. A branch separates these different versions, and allows the user to switch between these versions to work on them. Branches in Git are local to the repository, although it is possible to push branches to a central Git repository if you wish to share them with other users.

A branch created in a local repository, which was cloned from another repository, does not need to have a counterpart in the remote repository. Local branches can be compared with other local branches, and with remote tracking branches. A remote tracking branch proxies the state of a branch in another remote repository. Git supports the changes from different branches, and they can be combined through a system which also allows developers to automate such a process.

Choosing Git as your Repository

Choosing a repository for your software project is not unlike choosing where to host a website. The option you choose will depend on your circumstances, particularly the functionality you require, the amount of effort required to manage the project, the popularity of the service amongst the community you work in, and the size and diversity of contributors to your project.

Compared to other version control systems such as Subversion (SVN), an individual Git repository tends to be used for only one project, or perhaps even only one component of a larger project. This compares with SVN, where an organization may choose to have one repository that contains many independent projects. This separation is usually done to reduce network bandwidth, since cloning a Git repository involves copying the complete history of the project.

Many developers now prefer to use a distributed version control system such as Git over a more centralized system. The speed and convenience of always having a full repository history available locally can provide a significant productivity boost, while the improved branching merging options allow for many different development workflow scenarios that were difficult or not possible before.

These additional features and flexibility do come at a cost however, with the Git commands being considerably more complex to learn and master than other version control systems. However, once developers make the investment to learn Git they will begin to reap the benefits of this new approach to version control.

Continue Readingred arrow

How to use TortoiseSVN

TortoiseSVN is the easiest and most popular way to use Subversion under Windows operating systems. Getting started couldn’t be easier – this post provides step-by-step-instructions on how to connect to ProjectHut using TortoiseSVN and make your first commit.

Note: these instructions assume that you have already:

  • Created a ProjectHut account
  • Created a User using the ProjectHut Control Panel
  • Created a SVN repository using the ProjectHut Control Panel
  • Assigned access permissions to your SVN repository for your User

Once you have completed these steps, you can start using TortoiseSVN on your computer.

How to checkout out a SVN repository using TortoiseSVN

  1. First, start by downloading the TortoiseSVN client software and installing it on your computer.
  2. Login to the ProjectHut Control Panel (i.e. the admin/ area of your account).
  3. Locate the Subversion repository that you wish to connect to in the Subversion page.
  4. Right-click on the orange View Subversion Repository link button, and select Copy link address to store the repository URL in the clipboard. Right-click to get the SVN repository URL
  5. In Windows explorer, locate the directory where you wish to checkout your repository. Right-click and select the SVN Checkout... button. Right-click and select SVN Checkout...
  6. The TortoiseSVN Checkout dialog will appear. Paste the SVN repository URL into the URL of repository: field, specify the Checkout directory:, and click OK. Enter the SVN URL and checkout directory
  7. If you have set your SVN Permissions to require authenticated access to your repository, a dialog will appear where you can enter the username and password of on of the repository Users. Make sure to select the Save authentication checkbox to avoid having to re-enter the credentials each time you use TortoiseSVN. Enter User credentials
  8. Wait a few moments until the repository has finished checking out. Wait until the checkout operation completes.
  9. Use Windows Explorer to navigate to the directory containing the checked-out project. You will notice that the folder icon contains a green check icon – this indicates that there are no uncommitted changes contained in this folder, or any other folder underneath. The checked out repository

How to add files using TortoiseSVN

Once you have checked out a local copy of your repository, you can start using it by adding files.

In this example, we will begin by creating three top-level directories that make up a typical SVN repository (trunk/, branches, and tags/). Read our FAQ article on How to structure a SVN repository for a description of why this is a good idea.

  1. Using Windows Explorer, double-click on the checked out repository.
  2. Create three new empty directories, titled: branches, tags, trunk
  3. Highlight the three new directories, then right-click and select TortoiseSVN, then Add. Right-click to Add selected files to the repository.
  4. The TortoiseSVN Add dialog will appear. Here you can use the checkboxes to select or unselect files that are to be added to the repository. Make sure all three directories are checked, then click OK. Select the files you wish to add.
  5. A dialog will appear to confirm that the directories or files have been added to the local checked out repository. Files have been added to the local repository
  6. Now if you look at the project directory in Windows Explorer, you will notice that the three added directories appear with a blue add symbol next to them. This indicates that the files have been added to the local repository, but have not yet been uploaded to the server. The plus icons indicate the files have been scheduled to be added to the repository.

At this point, you may continue adding extra files or directories to the local repository. Likewise, you can also remove files if you no longer want to check them in. In this case, we are happy to add the three directories, so we will leave them as is.

How to commit files to the SVN server

When you are happy with the state of all the files in your local repository, you can commit the changes to upload them to the SVN repository stored on the ProjectHut server.

  1. Using Windows Explorer, navigate to the directory containing the checked-out project. You will notice that the folder now contains a red exclamation icon. This indicates that this directory, or one of the directories underneath, contains changes that have not yet been committed to the SVN repository.
  2. We will commit these changes now. Right-click on the project directory, and select SVN Commit... Right-click to select SVN Commit
  3. The TortoiseSVN Commit dialog will appear. In the large text-box, make sure to enter a detailed description of the commit, for example what has been added or changed. It is generally a good idea to always write meaningful log messages here to help other users (or yourself in the future) understand the contents of the commit, and why it was made. Here you also have a last opportunity to review the files being added, remove or updated and use the checkboxes to make changes. When you are happy with the commit, click OK. Review your commit and add a log message
  4. Wait a few moments while the commit operation is performed and the data is uploaded to the server. During this time, a dialog will appear to keep you informed of the status of the commit. When it has finished, click OK to dismiss the dialog. Wait for the SVN commit operation to finish
  5. You will now notice that the three new directories have been successfully added. The green check icon on each indicates that the changes have been committed to the server. Green checks indicate that the files have been committed to the server
  6. Using the ProjectHut Control Panel you can also confirm that a new revision has been committed to the server. Navigate to the Subversion repository list, and you will notice that the Revision number has been incremented to 1. Each new commit will result in this revision number being incremented. View the SVN revision in the ProjectHut Control Panel

That’s essentially all there is to start using TortoiseSVN to commit files to your ProjectHut SVN repository!

Continue Readingred arrow

The CVS Version Control System Explained

During December 1986, Dick Grune released a bunch of shell scripts by posting it to newsgroup comp.sources.unix. It contained many of the conflict resolution algorithms used in software that had been useful for many programmers for decades. This software was called CVS version control.

What is CVS version control?

Concurrent Version System (CVS) is open source software that records the history of your documents and source code. It tracks all changes in your files and saves all revisions without taking up too much disk space. It was originally built for programmers working on computer source code, as sometimes a bug is introduced when a certain modification is done on the software they are working on. However, by using CVS (or other version control systems such as Subversion and Git that have been developed since), they can easily restore the previous revisions of their files to determine what changes introduced the bug.

What are the benefits that you can gain from using CVS?

CVS version control is free, downloadable, and is easy to install and understand. Using CVS version control allows you to work on a file system using several machines. For example, you are working on a source code on your personal computer. You can access the repository using another computer and make local copies of the files. When you are finished editing the file, you can commit it back to the repository, and the CVS version control updates the file. CVS help prevent source trees from getting out of sync, hence preventing much confusion.

Also, CVS version control is a great tool for large projects with multiple users. It enables users to work on a single file and make edits to such file at the same time. The users save a local copy of the file and make their modifications. When they are finished making the necessary changes, they commit the files back into the repository. The users have an option to merge their files individually, then CVS merges all the changes to one final file. In case there are problems that arise from merging the file, the software alerts the users to make corresponding decisions.

CVS is also recommended for users with a slow Internet connection. They can simply make local copies of the files from the repository and edit them offline. When they are finished, they can connect to the Internet and CVS will sync the files.

What are the problems you can encounter with CVS?

Though CVS version control might be useful in some instances, it also has a number of limitations. CVS is a mature technology and lacks some functionality that newer version control tools have. For instance, CVS version control is not capable of atomic operation support, which prevents corruption of the source code should the network connection be interrupted. An atomic operation is a sequence of instructions that is guaranteed to be executed in succession, without any disruption, or not at all. An interrupted CVS connection may result in partial commits..

CVS also contains some security risks from symbolic links to files, and has not been updated since 2008. Moving or renaming files in CVS also does not include a version update, and branch operations in CVS are expensive, as CVS is not designed for long term branching.

Nowadays, CVS version is replaced by Subversion (SVN), which was originally made as an alternative to CVS. It fixes many of the bugs and issues inherent in the CVS system while maintaining high compatibility with it. Unlike CVS, SVN employs atomic operations which prevent corruption in the database.

Continue Readingred arrow