Working with Git
From PostgreSQL Wiki
This page collects various wisdom on working with the PostgreSQL Git repository. There are also Other Git Repositories you might work with.
First off, I'd suggest printing out a copy of the Working with CVS wiki page, and not read it. Burn it, it's a great symbolic gesture.
Contents |
Getting Started
A simple way to get started might look like this:
git clone git://git.postgresql.org/git/postgresql.git cd postgresql git checkout -b my-cool-feature $EDITOR git diff master my-cool-feature | filterdiff --format=context > ../my-cool-feature.patch
Note that git checkout -b my-cool-feature creates a new branch and checks it out at the same time. Typically, you would develop each feature in a separate branch.
See the documentation and tutorials at http://git.or.cz/ for a more detailed Git introduction.
PostgreSQL developers have traditionally preferred context diffs (diff -c) over unified diffs (diff -u). At least some major committers who you will probably have to run your patch by heavily prefer context diffs. Bizarrely, Git doesn't easily produce context diffs. Some claims in old versions of the git-diff-files man page that you can use the environment variable GIT_DIFF_OPTS to control this are wrong and have been removed in later versions.
The best solution we have so far is using filterdiff as in the above example. If you can't find patchutils, of which filterdiff is one, packaged for your operating system, get it from the patchutils project.
Publishing Your Work
If you develop a feature over a longer period of time, you want to allow for intermediate review. The traditional approach to that has been emailing huge patches around. The more advanced approach that we want to try (see also Peter Eisentraut's blog entry) is that you push you Git branches to a private (~user) area on git.postgresql.org, where others can pull your work, operate on it using the familiar Git tools, and perhaps even send you improvements as Git-formatted patches. Please write to mailto:gitadmin@git.postgresql.org to get an account.
Removing a Branch
Once your feature has been committed to the PostgreSQL CVS, you can usually remove your local feature branch. This works as follows:
# switch to a different branch git checkout master git branch -D my-cool-feature
Using the Web Interface
Try the web interface at http://git.postgresql.org/. It offers browsing, "blame" functionality, snapshots, and other advanced features, and it is much faster than CVSweb. Even if you don't care for Git or version control systems, you will probably enjoy the web interface.
RSS Feeds
The Git service provides RSS feeds that report about commits to the repositories. Some people may find this to be an alternative to subscribing to the pgsql-committers mailing list. The URL for the RSS feed from the PostgreSQL repository is http://git.postgresql.org/?p=postgresql.git;a=rss. Other options are available; they can be found via the home page of the web interface.
