« Previous - Version 12/20 (diff) - Next » - Current version
Firas Abbas, 02/10/2010 11:47 am


Git makes it easier for anyone to develop and contribute code to gnuradio. This article will describe how to use git with multiple repositiories so you can develop and publish your changes to gnuradio. The goal of this page is to help people manage git repositories so code may easily be shared among GNURadio developers.

The basic idea is you clone the gnuradio git repository and maintain a public repository with your work on github, or other public git server.

1. Clone the repository
    $ git clone http://gnuradio.org/git/gnuradio.git
2. Create a repository on a public git server such as http://www.github.org. Call it gnuradio-yourname. 3. Be sure to set your identity so git has good identity information for your commits.
    $ git config user.name "Your Name" 
    $ git config user.email [email protected]
4. Since this is an existing git repo, do the following steps (I called the project gnuradio-balister):
    $ cd gnuradio
    $ git remote add balister [email protected]:balister/gnuradio-balister.git
    $ git push balister master

Now you have a local repository and a copy on github so you can publish your work.

Updates

To update master on your public repository:

    $ git commit [options] [files] 
    $ git push balister master 

Branching

Create a local branch, and publish the new work.

1. Create the branch
    $ git branch new_work
2. Checkout the branch
    $ git checkout new_work
3. Do some work and commit it.
    $ git push balister new_work

Deleting Branches

When you are done with the branch delete it locally, and on the remote repository (if needed):

To delete your branch locally:

    $ git branch -d new_work

To Delete your branch from the server:

    $ git push balister :new_work

Remote Branches

If you want to create a local branch tracking a remote branch (e.g., to track a branch on the gnuradio server):

    $ git branch --track local_new_work origin/new_work
    $ git checkout local_new_work

Assuming that "new_work" is a branch on the repository you cloned originally

Converting From Old Subversion Repository to the New Git Repository

The subversion imported commits have the revision number at the end of the description in the "git-svn-id" line. For example, you can create and checkout a new branch with svn revision 10184 by doing the following.

1) Find the commit hash from the git-svn-id.

  $ git log --grep=git-svn-id.*@10184

2) Create and checkout a new branch named r10184 from the commit hash.

  $ git checkout -b r10184 cd7b07f0140ddff6

Other Resources

Some external resources that may be useful for learning/working with git: