You know you can create your own git commands right? Git supports custom aliases. They rock.

The hello world examples are just creating shortcuts for existing commands.
git config --global alias.co checkout
Simple, right?

You can put global aliases in your user Git config file: ~/.gitconfig

You can also put them in the config file for a given repository: project/.git/config

Here's a list of mine.

Safe pull. Always does a fetch, but only updates your local branch if you can fast forward. As easy way to make sure you don't create a merge with upstream due to local weirdness.

Definition: sp = pull --ff-only

Usage: git sp

Fetch all. Fetch all remotes for this repository. Used a lot when I have an upstream branch and my fork.

Definition: fa = fetch --all

Usage: git fa

Grep with a simple string match. See the full breakout here. Basically lets my search for simple strings across text files explicitly without regex. Move into a subdirectory and grep will search only that dir and below. Use it constantly.

Definition: gp = grep -I -F -n -e

Usage: git gp 'void main('

Grep TODOs. Find all instances of TODO. Move into a subdirectory and grep will search only that dir and below.

Definition: g2do = grep -n TODO

Usage: git g2do

Github! Open the GitHub page for the current repo. Found here. There are a lot of ways to skin this cat. This works for me on mac.

Definition: gh = "!open https://github.$(git config remote.origin.url | cut -f2 -d. | tr ':' /)"

Usage: git gh

Find file. Exactly what it says. Finds file where any part of the file path matches the provided string.

Definition: ff = "!git ls-tree -r --name-only HEAD | grep -F"

Usage: git ff index.html -- Note, this will include /index.html.haml and /index.html/resources/foo.png.

Hope you find some of these useful.

Happy hacking!