Skip to content

Instantly share code, notes, and snippets.

@Peeja
Created November 5, 2008 17:51
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 Peeja/22386 to your computer and use it in GitHub Desktop.
Save Peeja/22386 to your computer and use it in GitHub Desktop.
# Git aliases for bash
alias gst='git status'
alias gf='git fetch'
alias gl='git pull'
alias gp='git push'
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gb='git branch'
alias gba='git branch -a'
function gbt() { git checkout --track origin/$1 -b $1; }
alias ga='git add'
alias gai='git add -i'
# alias gdc='git diff --cached | mate'
#
# function gd() {
# git diff "$@" | mate
# }
alias gd='git diff'
alias gdc='git diff --cached'
alias gcps='git cherry-pick -n -m 1 stash'
by_status() {
ruby <<-RUBY
files = []
IO.popen("git status").each do |l|
if l =~ /^#\s+$1:\s+(.+)$/
files << \$1
end
end
puts files.join("\n")
RUBY
}
unmerged() { by_status unmerged; }
modified() { by_status modified; }
alias untracked='gst | ruby -n -e "if \$u; puts \$1 if \$_=~/^#\t(.+)\$/; else; \$u=(\$_=~/to include in/); end"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment