Skip to content

Instantly share code, notes, and snippets.

@lsavino
Last active June 12, 2017 17:29
Show Gist options
  • Save lsavino/77ac7bdc4751d0b504233df1be097ca6 to your computer and use it in GitHub Desktop.
Save lsavino/77ac7bdc4751d0b504233df1be097ca6 to your computer and use it in GitHub Desktop.
Setup for bash
Link to project:
git://github.com/lsavino/git-poems.git
# git prompt command from:
# https://github.com/git/git/blob/8976500cbbb13270398d3b3e07a17b8cc7bff43f/contrib/completion/git-prompt.sh
source ~/.git-prompt.sh
GIT_PS1_SHOWDIRTYSTATE=1
GIT_PS1_SHOWCOLORHINTS=1
GIT_PS1_SHOWUNTRACKEDFILES=1
PROMPT_COMMAND='__git_ps1 "\u@\h:\W" "\\\$ "'
[alias]
# Shows git history as a graph (with summarized commits)
hist = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
# Shows the source of added changes
staged = diff --staged
# Lists all your aliases
alias=!git config --list | grep alias
# Creates a zipped file of the whole repo (git history included) one level up from the current directory
panic = !tar cvf ../git_panic.tar .
# Abbreviations
st=status
br=branch
[user]
name = Laura Savino
email = lau.rasavino@gmail.com
[core]
excludesfile = /Users/savinola/.gitignore
# These are aliases for an in-workshop game that sometimes throws away all your changes 😇
[alias]
# Permanently removes all uncommitted changes
throwitallaway = "!f(){ git reset --hard HEAD && git clean -fd; };f"
# Unstages all work, adds a line to a random file in the repo, & commits the result
badapple = "! files=(./*);"\
"randfile=\"${files[RANDOM % ${#files[@]}]}\";"\
"echo \"BOO!!\" >> $randfile;"\
"git reset --soft HEAD;"\
"git add $randfile;"\
"git commit -m \"OH NO THIS COMMIT SHOULD NOT BE HERE\";"\
"echo \"\n\noh dear, something seems to have been committed by mistake...\n\n\";"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment