William's miscellaneous git tools

Here are a bunch of git-related tools I've found useful at some point. The git repository for all of these is cloneable at git://gitorious.org/willgit/mainline.git/ (browse).


git-wtf is a script to display the state of your repository in a readable and easy-to-scan format.

git-wtf tries to ease the task of having many git branches. It's also useful for getting a summary of how tracking branches relate to a remote server.

git-wtf shows you:

For each of these relationships, git-wtf displays the commits pending on either side, if any. It displays checkboxes along the side for easy scanning of merged/non-merged branches.

If you're working against a remote repo, git-wtf is best used between a 'git fetch' and a 'git merge' (or 'git pull' if you don't mind the redundant network access).


$ git wtf
Local branch: master
[x] in sync with remote
Remote branch: origin/master (git@gitorious.org:willgit/mainline.git)
[x] in sync with local

Feature branches:
{ } origin/experimental is NOT merged in (1 commit ahead)
    - some tweaks i'm playing around with [80e5da1]
{ } origin/dont-assume-origin is NOT merged in (1 commit ahead)
    - guess primary remote repo from git config instead of assuming "origin" [23c96f1]
$ git wtf
Local branch: master
[ ] NOT in sync with remote (needs push)
    - Add before-search hook, for shortcuts for custom search queries. [4430d1b] (edwardzyang@...; 7 days ago)
Remote branch: origin/master (git@gitorious.org:sup/mainline.git)
[x] in sync with local

Feature branches:
{ } origin/release-0.8.1 is NOT merged in (1 commit ahead)
    - bump to 0.8.1 [dab43fb] (wmorgan-sup@...; 2 days ago)
[ ] labels-before-subj is NOT merged in (1 commit ahead)
    - put labels before subject in thread index view [790b64d] (marka@...; 4 weeks ago)
{x} origin/enclosed-message-display-tweaks merged in
(x) experiment merged in (only locally)

NOTE: working directory contains modified files


git-publish-branch is a simple script to ease the unnecessarily complex task of "publishing" a branch, i.e., taking a local branch, creating a reference to it on a remote repo, and setting up the local branch to track the remote one, all in one go.

You give it a branch name, and that branch is published in your remote repository. That's it. If you use -d, it will delete the remote reference.

Useful if you publish your topic branches to the outside world.


git-rank-contributors is a trivial script that paws through your logs and ranks all the contributors by the size of their diffs. As always, bigger is better!

If you use -v, you'll get the raw diff sizes.

If you use -o, you'll get high-tech email obfuscation.

Output with just -o may be suitable for piping into a CREDITS file. It probably will require some editing in case people submit from more than one email address, though.

This is similar to git shortlog -s -n --no-merges, but counts diff size rather than number of commits.


git-show-merges is a precursor to git-wtf. It's a simple tool that shows you which branches have been merged in to the current branch, and which haven't. That's it. You can also specify multiple non-topic branches (merge branches?) on the commandline.

$ git show-merges
merged into next:

not merged into next: 


git-walkthrough-add (deprecated)

In recent gits, git add -p does exactly what this tool does. So I will not be putting a lot of energy into maintaining this any more.

git-wt-add is a darcs-style interactive staging script for git. It walks you through unstaged changes on a hunk-by-hunk basis and allows you to pick the ones you'd like staged. It features colorized diff output and a full set of navigation and dispatch commands.

git-wt-add is based on git-hunk-commit --darcs, which was very close to what I wanted, but wasn't quite it. In general git-wt-add makes no attempt to conform to the real darcs interface, but it's probably pretty close.


This collection of vaguely useful tools is brought to you by William Morgan and the following honorable contributors: