Denis Barushev

Email: barushev@gmail.com

Adding Bash Completion for Git on Mac OS X Leopard

Copy this code and paste it into Terminal.

This also should work for any *NIX.

Update

There are the easiest ways to add bash completion for git.

For Mac OS X

Install git via MacPorts:

sudo port install git-core +bash_completion

Then add the following lines at the end of your ~/.profile:

if [ -f /opt/local/etc/bash_completion ]; then
    . /opt/local/etc/bash_completion
fi

For Ubuntu

sudo aptitude install git-completion

For Fedora

sudo smart install bash-completion

Using Kompare for Git Diffs

git-kompare

It’s possible to use kompare as a graphical diff viewer for git. I created file git-kompare in my /usr/local/bin/ directory with such content:

git diff $* | kompare -

I also created alias gk for this command in my ~.bashrc:

alias gk='git-kompare'

Now I can use gk command instead of git diff with all its options.

Bash Script That Deletes Itself

suicide.sh

#!/bin/rm

Truncating a File to Zero Bytes

> log/development.log

Removing a Remote git Branch

git push origin :branch_name