Skip to content

Instantly share code, notes, and snippets.

@hachibeeDI
Created October 19, 2012 10:56
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 hachibeeDI/3917553 to your computer and use it in GitHub Desktop.
Save hachibeeDI/3917553 to your computer and use it in GitHub Desktop.
zsh function for git
# http://qiita.com/items/1f01aa09ccf148542f21
gs() {
git status -sb
}
gst() {
git status -sb | head -n 1
git status -sb | sed '1d' | grep --line-number '^'
}
gsa() {
local targfile;
targfile=`git status -sb |grep -v "^#" | awk '{print$1="";print}' |grep -v "^$" | awk "NR==$1" | sed "s/\s//g"`
echo "add $targfile"
git add $targfile
}
gsd() {
local targfile;
targfile=`git status -sb |grep -v "^#" | awk '{print$1="";print}' |grep -v "^$" | awk "NR==$1" | sed "s/\s//g"`
echo "show diff $targfile"
git diff --color -- $targfile
}
gsv() {
local targfile;
targfile=`git status -sb |grep -v "^#" | awk '{print$1="";print}' |grep -v "^$" | awk "NR==$1" | sed "s/\s//g"`
vim $targfile
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment