i3 init
This commit is contained in:
59
.zsh/functions/06_git
Normal file
59
.zsh/functions/06_git
Normal file
@@ -0,0 +1,59 @@
|
||||
if [[ -x `which git` ]]; then
|
||||
alias g=git
|
||||
function git-branch-name () {
|
||||
git branch 2> /dev/null | grep '^\*' | sed 's/^\*\ //'
|
||||
}
|
||||
function git-dirty () {
|
||||
git status 2> /dev/null | grep "nothing to commit (working directory clean)"
|
||||
echo $?
|
||||
}
|
||||
function gsrb () {
|
||||
branch=$(git-branch-name)
|
||||
git checkout master
|
||||
git svn rebase
|
||||
git checkout "${branch}"
|
||||
git rebase master
|
||||
}
|
||||
function git-need-to-push() {
|
||||
if pushtime=$(git status | grep 'Your branch is ahead' 2> /dev/null); then
|
||||
echo "â "
|
||||
fi
|
||||
}
|
||||
function git-prompt() {
|
||||
gstatus=$(git status 2> /dev/null)
|
||||
branch=$(echo $gstatus | head -1 | sed 's/^# On branch //')
|
||||
dirty=$(echo $gstatus | sed 's/^#.*$//' | tail -2 | grep 'nothing to commit (working directory clean)'; echo $?)
|
||||
if [[ x$branch != x ]]; then
|
||||
dirty_color=$fg[green]
|
||||
push_status=$(git-need-to-push)
|
||||
if [[ $dirty = 1 ]] { dirty_color=$fg[red] }
|
||||
[ x$branch != x ] && echo " %{$dirty_color%}$branch%{$reset_color%} $push_status"
|
||||
fi
|
||||
}
|
||||
function git-scoreboard () {
|
||||
git log | grep '^Author' | sort | uniq -ci | sort -r
|
||||
}
|
||||
function git-track () {
|
||||
branch=$(git-branch-name)
|
||||
git config branch.$branch.remote origin
|
||||
git config branch.$branch.merge refs/heads/$branch
|
||||
echo "tracking origin/$tracking"
|
||||
}
|
||||
function github-init () {
|
||||
git config branch.$(git-branch-name).remote origin
|
||||
git config branch.$(git-branch-name).merge refs/heads/$(git-branch-name)
|
||||
}
|
||||
|
||||
function github-url () {
|
||||
git config remote.origin.url | sed -En 's/git(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\3\/\4/p'
|
||||
}
|
||||
|
||||
# Seems to be the best OS X jump-to-github alias from http://tinyurl.com/2mtncf
|
||||
function github-go () {
|
||||
open $(github-url)
|
||||
}
|
||||
|
||||
function nhgk () {
|
||||
nohup gitk --all &
|
||||
}
|
||||
fi
|
||||
3
.zsh/functions/07_felix
Normal file
3
.zsh/functions/07_felix
Normal file
@@ -0,0 +1,3 @@
|
||||
function cpstat() {
|
||||
rsync -ah --progress "$1" "$2"
|
||||
}
|
||||
Reference in New Issue
Block a user