-
-
Save ben/903cbc9e9938771b65e7 to your computer and use it in GitHub Desktop.
Git for Ninjas – ConFoo 2013
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export CLICOLOR=1 | |
export PATH=~/bin:/opt/boxen/homebrew/bin:$PATH | |
. ~/.git-completion.bash | |
# @gf3’s Sexy Bash Prompt, inspired by “Extravagant Zsh Prompt” | |
# Shamelessly copied from https://github.com/gf3/dotfiles | |
# Screenshot: http://i.imgur.com/s0Blh.png | |
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then | |
export TERM=gnome-256color | |
elif infocmp xterm-256color >/dev/null 2>&1; then | |
export TERM=xterm-256color | |
fi | |
if tput setaf 1 &> /dev/null; then | |
tput sgr0 | |
if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then | |
MAGENTA=$(tput setaf 9) | |
ORANGE=$(tput setaf 172) | |
GREEN=$(tput setaf 190) | |
PURPLE=$(tput setaf 141) | |
WHITE=$(tput setaf 256) | |
else | |
MAGENTA=$(tput setaf 5) | |
ORANGE=$(tput setaf 4) | |
GREEN=$(tput setaf 2) | |
PURPLE=$(tput setaf 1) | |
WHITE=$(tput setaf 7) | |
fi | |
BOLD=$(tput bold) | |
RESET=$(tput sgr0) | |
else | |
MAGENTA="\033[1;31m" | |
ORANGE="\033[1;33m" | |
GREEN="\033[1;32m" | |
PURPLE="\033[1;35m" | |
WHITE="\033[1;37m" | |
BOLD="" | |
RESET="\033[m" | |
fi | |
export MAGENTA | |
export ORANGE | |
export GREEN | |
export PURPLE | |
export WHITE | |
export BOLD | |
export RESET | |
function parse_git_dirty() { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]] && echo "⚡" | |
} | |
function parse_git_branch() { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/" | |
} | |
PS1="\033[G\[${BOLD}${MAGENTA}\]\u \[$WHITE\]in \[$GREEN\]\w\[$WHITE\]\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on \")\[$PURPLE\]\$(parse_git_branch)\[$WHITE\]\n\$ \[$RESET\]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[user] | |
name = Me | |
email = bs@github.com | |
[color] | |
ui = auto | |
[alias] | |
lg = log --graph --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cowsay Rebase! | |
gitx | |
git merge master | |
git reflog | |
git reflog master | |
git reset --hard HEAD@{1} | |
git rebase master | |
git rebase master --interactive | |
cowsay Bisect! | |
./new_test.sh | |
git lg | |
git bisect start | |
git bisect good 2b241 | |
git bisect bad | |
git lg | |
./new_test.sh | |
git bisect good | |
git lg | |
./new_test.sh | |
git bisect bad | |
./new_test.sh | |
git bisect bad | |
git show | |
git lg | |
git bisect reset | |
git lg | |
git bisect good 2b241 | |
git bisect bad | |
git bisect run ./new_test.sh | |
git bisect reset | |
cowsay Submodules! | |
cat ./new_test.sh | |
git blame critical.txt | |
cowsay Submodules! | |
ls | |
ls -la | |
ls -a | |
git submodule add ../bisect | |
ls | |
ls bisect/ | |
tree | |
git commit -am 'add submodule' | |
git show | |
cd bisect | |
git lg | |
git checkout bf4a9fd | |
cd .. | |
git status | |
git diff | |
git commit -am 'Avoid security issue' | |
git clone . sm | |
cd sm | |
tree | |
ls bisect/ | |
git submodule update --init | |
cd .. | |
git clone . sm2 -r | |
git clone --recursive . sm2 | |
cowsay Filter-branch: Rewrite all the things! | |
git lg | |
ls | |
git filter-branch --env-filter 'GIT_AUTHOR_NAME=Me' HEAD~10..HEAD | |
git lg | |
ls | |
git filter-branch -f --tree-filter 'rm -f pom.xml' -- --all | |
ls | |
git checkout v1.2.1 | |
ls | |
git checkout master | |
git reflog master | |
ls .git/refs/original/ | |
tree .git/refs/original/ | |
ls | |
git filter-branch -f --subdirectory-filter src --prune-empty -- --all | |
ls | |
cowsay Shell tricks! | |
vi ~/.bash_profile | |
touch hi | |
git lg | |
vi ~/.gitconfig | |
cowsay Subversion! | |
svn co https://github.com/retlehs/roots | |
tree -L 2 roots | |
tree -L 2 roots | |
cowsay Hub! | |
alias git=hub | |
git --version | |
git | |
git clone twitter/iago | |
git browse twitter/iago | |
cd iago/ | |
git browse |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment