Contributing to projects managed with git

Problem: You want to apply patches to a project managed with git, but have not the infrastructure for so doing.

If you google for "git howto" you'll most likely get documention on how to use git from a project managing perspective, including information on how to setup a git repository. If you only want to contribute to an already existing git repository, this article is for you.

Installing git

# aptitude install git-core git-email

Invoking the tools in the git suite

There is two ways of invoking tools in the git kit, using the command option of the git command, or using the alias version.

This boils down to that you can either write

git config

or you write

git-config

and both of them will accomplish the same thing.

Since tab-completion is handy, I prefer the aliased versions: git-config, git-clone, git-show ...

Configure git

$ git-config --global user.name "Hans Ekbrand"
$ git-config --global user.email "hans.ekbrand@gmail.com"

Get the project sources, and go into them

$ git-clone git://github.com/cameronbracken/pgfSweave.git

This repository is stored in a directory called pgfSweave, which is automatically created by the clone command above. To continue work on this project, you will have go into the pgfSweave directory (make that your current dir).

$ cd pgfSweave

Test if git is working by looking at the latest commit

$ git-show

Commit

When you are done making the change you want to commit to the manager(s), git-commit is what you need. The -m option lets you connect a comment to the patch.

$ git-commit -a -m "Removing any references to \pgfrealjobname since these are not necessary with pgfSweave 1.1 and above"

Sending the patch

Your local repository now has the state you want the central repository to have. But you don't have priviledges to write to that repository, so instead you can email the patch to the manager. This might sound like it involves manually work creating an email, but git has special commands to automate this procedure:

$ git-format-patch -s -M origin/master

This creates a file 0001-Removing-any-references-to-pgfrealjobname-since-the.patch in the top level of the git repository. Before you actually send it, set the maintainer email:

$ git-config sendemail.to "Her Name <her.name@upstream.com>"

Now, you can send the patch:

$ git-send-email 0001-Removing-any-references-to-pgfrealjobname-since-the.patch

You will be asked to confirm the sender address and asked about a message-id for the in-reply-to header, but both of these questions has good defults, so just press enter twice and be done with it.

comments powered by Disqus


Back to the index

Blog roll

R-bloggers, Debian Weekly
Valid XHTML 1.0 Strict [Valid RSS] Valid CSS! Emacs Muse Last modified: oktober 17, 2019