Skip to content

Instantly share code, notes, and snippets.

@baojie
Last active December 23, 2015 02:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baojie/6567756 to your computer and use it in GitHub Desktop.
Save baojie/6567756 to your computer and use it in GitHub Desktop.
install some useful git shortcuts. Depends on https://github.com/visionmedia/git-extras
# show log in online and color
# Usage: tig
sudo apt-get install tig
# git extras
# Usage: see https://github.com/visionmedia/git-extras
(cd /tmp && git clone --depth 1 https://github.com/visionmedia/git-extras.git && cd git-extras && sudo make install)
# full commit history with diff of a file
# Usage: git history foo.py
git config --global alias.history 'log --follow --color -p'
# reset the working dirtory to head, remove all edit
# Usage: git giveup
git config --global alias.giveup 'reset HEAD^ --hard'
# push too all remote
# Usage: git pushall
git config --global alias.pushall '!sh -c "git remote | xargs -L1 -I {} git push {} master"'
# Show commit history as a graph
# Usage: git graph
git config --global alias.graph 'log --graph --oneline --all --decorate --color'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment