Try then by yourself! The first takes the name of a person or their email address. The second takes a commit name.

A 'debug' alias to help debugging builtins

When debugging builtins, you often use gdb to analyze the runtime state. However, you have to disable the pager, and often you have to call the program with arguments. If the program to debug is a builtin, you can use this alias:

Most of the complication is because the last argument must be passed to git mailsplit, while the others must be passed to git send-email.

SVN-like aliases

Here are some aliases to help git-svn users migrate away from SVN. Be careful though - trying to completely recreate an SVN environment with aliases will cause problems when commands don't quite do what you expect.

[alias]
st = status
# SVN-compatible versions of commands
# "foo-svn" is used here instead of "svn-foo" so that it's suggested when people tab-complete "git fo..."
cherry-pick-svn = !GIT_EDITOR='sed -i /^git-svn-id:/d' git cherry-pick -e
branch-svn = svn branch
merge-svn = merge --squash
push-svn = svn dcommit
# The next two lines are recommended, as their strengths outweigh their weaknesses.
# Strength: they make transitioning from SVN easier
# Weakness: they make teaching `git pull` harder when you move to git on the server
# Weakness: they encourage people to think that rebasing is a safe default
up = svn rebase
update = svn rebase
# The next line *is not* recommended, as its weaknesses outweigh its strengths.
# Strength: it makes transitioning from SVN easier
# Weakness: it makes teaching `git add`, `git commit -a`, the index, etc. harder
# Weakness: it encourages people to think that a git commit is analogous to an SVN commit
#ci = commit

which is a list of the tips of linear sequences of commits that are in pu, but not in next.

Obtaining the Empty Tree SHA1

While the empty tree sha1 4b825dc642cb6eb9a060e54bf8d69288fbee4904 is known to git, you may need to generate it.

[alias]
empty-tree-sha1 = hash-object -t tree /dev/null

Diffing against the empty tree can be useful for things like generating
a patch which represents the creation of an entire slice of your working
tree (squashing the effect of all commits so far into a single patch):

$ git diff -p $(git empty-tree-sha1) some-interesting-subdir/

You can even get a complete listing of any whitespace violations in the
current working tree:

$ git diff --check $(git empty-tree-sha1)

Getting the diff of a branch since it forked from another branch, or since the last merge

Update: This alias is unnecessary.

git diff A...B

does the same thing.

To see the changes in a branch since it was forked from another branch, or since the last merge with the origin branch, you can add this 'forkdiff' alias to $HOME/.gitconfig:

It uses git-merge-base to determine the fork-point (the commit that is common to both the branches) and does a git-diff between that commit and the second branch.

Usage

git forkdiff <forked from branch> <forked branch> [git-diff-options]

Example

git forkdiff origin/master my_forked_branch --stat

Untrack a file

In some scenarios it's necessary to untrack a particular file in say a production branch to avoid developer content spilling into it. As a rare activity it can be difficult to locate in the manuals. The git rm man page 'Discussion' section gives additional details regarding the blobbing of filenames.

[alias]
untrack = rm --cache --

Checkout recursive submodules

Checking out a repo and it's submodules is not part of the regular 'git checkout' command. Normally you need a two command sequence

git checkout *oldcommit*
git submodule update --recursive

These can be combined using the tricks above, and using '&&' for command chaining to prevent losing work when you mistype the submodule name, into a simple alias