Skip to content
This repository was archived by the owner on Oct 23, 2020. It is now read-only.

Useful Git Aliases

Doug Jacobsen edited this page Nov 26, 2013 · 7 revisions

This is a list of useful git aliases, and the commands to define them in git.

Abbreviated status

Just abbreviates status to st. Similar things can be defined like ci can be commit, and co can be checkout.

git config --global alias.st status

usage: git st

Graph view of log in terminal

Prints a graph based log of a branch (or all branches if the --all flag is appended) on the command line. Similar to gitk.

git config --global alias.logg "log --graph --oneline --abbrev-commit --decorate"

usage: git logg

Svn style export

Exports a branch from your local repository into a directory.

git config --global alias.export "!sh -c 'git archive ${1} | tar xv -C ${2}' -"

usage: git export branch_name export_directory

Easy updating/pruning of all remote repositories

Updates remote tracking branches, and deletes remote tracking branches for branches that have been deleted.

git config --global alias.up "fetch --all -p"

usage: git up

Make a new branch based on current working directory

NOTE: This syntax only works for bash.

This creates and checks out a new branch determined by the last two directories in your current working directory.

git config --global alias.path-br '!bash -xc "git checkout -b "${PWD#${PWD%/*/*}/}" MPAS-Dev/MPAS/develop"'

usage: git path-br

Clone this wiki locally