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
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.
sp = pull --ff-only
Fetch all. Fetch all remotes for this repository. Used a lot when I have an upstream branch and my fork.
fa = fetch --all
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.
gp = grep -I -F -n -e
git gp 'void main('
Grep TODOs. Find all instances of TODO. Move into a subdirectory and grep will search only that dir and below.
g2do = grep -n TODO
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.
gh = "!open https://github.$(git config remote.origin.url | cut -f2 -d. | tr ':' /)"
Find file. Exactly what it says. Finds file where any part of the file path matches the provided string.
ff = "!git ls-tree -r --name-only HEAD | grep -F"
git ff index.html-- Note, this will include
Hope you find some of these useful.