Basic Git Usage

    Version as of 19:20, 19 Jan 2018

    to this version.

    Return to Version archive.

    View current version

    Git is a very powerful source code management system. Here, we will quite deliberately only cover the basic stuff necessary for Gromacs development and try to keep it simple. If you want to learn more, including how to set up your own repository for a non-gromacs project, consult the official git documentation instead. 

    Getting Git

    Just as CVS, Git is a (newer) program you need to have installed to be able to use it. Check if you have it with the command "which git". Many modern Linux systems already come with it preinstalled, or you might be able to get it in a single step with a command like "sudo apt-get install git-core". Otherwise, you can find both binaries and source code from the official git site. For reference, the Gromacs Git server currently runs version, but you should be able to use interact with it using older versions too. 

    Understanding servers & repositories

    The master Gromacs source code repository is available from the server, and there will soon be a public read-only backup available at that is updated automatically (useful if the main server is unreachable for some reason). On both of these servers, there are a number of independent repositories. If you are used to CVS, a Git repository roughly corresponds to a CVS module. Each repository can have multiple branches. On the main server we have at least the repositories:

    • gromacs.git - The Gromacs source code (corresponds to the old CVS 'gmx' module)
    • manual.git - The Gromacs manual latex source
    • regressiontests.git - A suite of regression tests that (old 'gmxtest' module)
    • libxdrfile.git - A separate library to read/write our XDR compressed data files

    However, in contrast to CVS you don't interact directly with our repositories when you modify code! When you "check out", you really make a complete clone of the repository, and then interact with our own copy. You can even create arbitrary local branches that track some other branch in our repository. Developers with write permission can then separately "push" their changes to the main repository, after which they will show up to everybody. Similarly, you "pull" to get your local repository synchronized with a remote one. The beauty of this is that anybody can create a public repository where they share their Gromacs changes, and you call also "pull" in modifications from multiple other repositories.

    In addition to the "official" Gromacs repositories, many of the core developers will also have their own public repository available on the server, which you access in a slightly different way (more below). It is also straightforward to set up your own public repository at a place like (free for open source).

    Checking out a new repository

    To make a local copy of a repository, you use the command "git clone" followed by a specification of a repository. To do this anonymously with read-only access you just write

    git clone git://

     This uses a special "git" protocol (that's what the git:// part means) that talks to a daemon running on, accessing the main gromacs.git repository. 

    Page last modified 12:02, 13 Sep 2011 by rossen