Paul's Tutorials - logoGit Mini-tutorial



When working on a coding project in a large group, it is imperative that everyone in the group has access to the latest version of the codebase. Additionally, it is also important that the group have a backup of their code in case things go haywire.

This has been an issue of continuing importance basically as long as large group programming projects have existed. As a result, tools known as version control systems, or VCS for short, were developed. These tools are designed to watch folders (specifically ones containing code projects) and keep track of the changes that are made to the files within. Once a group member has made changes that they are satisfied with, they then upload these changes to a web server. At this point, the other group members can then use the same software to fetch the new code and download it into their own copy.

On a robotics team, you will be working with a number of your peers on a programming project: that is, your robot's codebase. On the HOT Team, we use a versatile VCS called git to keep track of changes to our projects and to ensure everyone is using the same code.

This short(er) tutorial will teach you the features that git has to offer, how it works, and how to use it.

In addition to this tutorial, there are few good references and resources covering git that you should consult as well:

Software

Yet, of course, you need some software for your computer.

Windows

Depending on your situation, you will want to get different software.

However, regardless of your situation, it is still a good idea to get the core git package for Windows.

Eclipse

If you are using Eclipse (and, if you're here for robotics, you probably are), then the best thing for you is the EGit Eclipse plugin, which embeds git functions right in Eclipse.

HOT Team programming students: You will be using this to handle git operations.

Here's how to get it:

  1. If you're using a team computer, it's possible that EGit is already installed. Open Eclipse, go to Help → Installation Details. If Eclipse Git Team Provider is listed, then you're all set! If not, continue with the steps below.
  2. In Eclipse, go to Help → Install New Software.
  3. In the Work with: box, select Luna, or Mars, or whatever your Eclipse release is (the URL should be http://download.eclipse.org/releases/<release>).
  4. Eclipse will load all software availabe through your release. This will take some time.
  5. Once the list has loaded, expand the Collaboration folder.
  6. Scroll down until you see Eclipse Git Team Provider, and check it.
  7. Select Next. You may be presented with a license agreement. Accept it (it's an open-source license).
  8. Select Install.
  9. Once the installation has finished, restart Eclipse.
  10. Once restarted, the EGit plugin will be installed. Any open projects that are a git repository will have an indicator to the right of the project name in the project explorer with the current branch and current sync state with the remote repository.
  11. To access git's functions, right-click on the repository in the project explorer, and open the Team menu.

TortoiseGit

TortoiseGit is a Windows Explorer plug-in that provides GUI access to all of Git's features via the right-click menu in Windows Explorer.

This option is recommended if you are not using Eclipse to manage your git repositories.

In order for TortoiseGit to work, you need to download the core git package if you haven't already.

Download

GitHub for Windows

GitHub for Windows is a workflow-based git client. It is a little easier for new git users to use, although it hides a few of git's more advanced features for the sake of simplicity.

Download

Mac

Again, there are different software packages that you can get for Mac.

If you are using Eclipse, you can install EGit as described above.

GitHub for Mac

GitHub also develops a program very similar to GitHub for Windows for OS X. It is also workflow-focused, and, like GitHub for Windows, hides some of git's advanced features for the sake of simplicity.

Download

Linux

Most distributions should have the commandline git packaged in their repositories. Search on git or git-core.

Since Eclipse is also available for Linux, you can install the git plugin using the steps above, if you are using Eclipse.

On Linux, the general expectation is that git users will be using the command line git (which is honestly the most straightforward approach). There are not many graphical tools to manipulate git repositories in Linux, and the ones that do exist are really just history viewers. I would recommend, however, that you install a graphical merge tool (kdiff3 for KDE and meld for GNOME).

Chapter Index


  Introduction Chapter 1: Concepts →