diff --git a/git/bin/git-attic b/git/bin/git-attic new file mode 100755 index 0000000..f7c8ee5 --- /dev/null +++ b/git/bin/git-attic @@ -0,0 +1,9 @@ +#!/bin/sh +# git-attic [-M] [PATH] - list deleted files of Git repositories +# +# Use -M to not show renamed files, and other git-log options as you like. + +git log --raw --no-renames --date=short --format="%h %cd" "$@" | + awk '/^[0-9a-f]/ { commit=$1; date=$2 } + /^:/ && $5 == "D" { print date, commit "^:" $6 }' | + git -p column diff --git a/git/bin/git-neck b/git/bin/git-neck new file mode 100755 index 0000000..562cd78 --- /dev/null +++ b/git/bin/git-neck @@ -0,0 +1,10 @@ +#!/bin/sh -e +# git neck [-r] [COMMIT] - show commits until first branching point + +[ "$1" = -r ] && shift && R=-r +COMMIT=$(git rev-parse --no-flags --default HEAD "$@") +# skip first elements of trail +TORSO=$(git trail $R $COMMIT | cut -d' ' -f2 | uniq | sed -n 2p) +# fall back to initial commit on empty trail +: ${TORSO:=$(git rev-list --max-parents=0 HEAD)} +git log --oneline $(git rev-parse --no-revs "$@") $COMMIT...$TORSO diff --git a/git/bin/git-trail b/git/bin/git-trail new file mode 100755 index 0000000..1d7f133 --- /dev/null +++ b/git/bin/git-trail @@ -0,0 +1,23 @@ +#!/bin/sh -e +# git trail [-r] [-t] [COMMIT] - show all branching points in Git history + +[ "$1" = -r ] && shift || REMOTES="-e refs/remotes/" +[ "$1" = -t ] && shift || TAGS="-e refs/tags/" +COMMIT=$(git rev-parse --no-flags --default HEAD "$@") + +{ git for-each-ref | grep -v -e '^$' $TAGS $REMOTES + git log --date=short --format="%cd %h %H" "$@" +} | awk ' + $2 == "commit" || $2 == "tag" { + "git merge-base '$COMMIT' " $1 | getline mb + merge[mb] = merge[mb] " " $3 + } + { + if ($3 in merge) { + split(merge[$3], mbs, " ") + for (i in mbs) { + "git name-rev --name-only --refs=\"" mbs[i] "\" " $3 | getline nr + if (nr != "undefined") print $1, $2, nr # skip unreachable commits + } + } + }' | git -p column # paginate output diff --git a/git/gitconfig.symlink b/git/gitconfig.symlink index 489f833..9c96723 100644 --- a/git/gitconfig.symlink +++ b/git/gitconfig.symlink @@ -31,7 +31,7 @@ gn = goodness gnc = goodness --cached - # Fancy logging. + # Fancy logging # h = head # hp = head with patch # r = recent commits, only current branch @@ -45,6 +45,8 @@ ra = !git r --all l = "!. ~/.githelpers && pretty_git_log" la = !git l --all + + news = log -p HEAD@{1}..HEAD@{0} [color] diff = auto status = auto diff --git a/osx/aliases.zsh b/osx/aliases.zsh new file mode 100644 index 0000000..ada080e --- /dev/null +++ b/osx/aliases.zsh @@ -0,0 +1 @@ +alias iossim="open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app" \ No newline at end of file diff --git a/sublime2/User/Ruby.sublime-settings b/sublime2/User/Ruby.sublime-settings index bdf7cc6..153d041 100644 --- a/sublime2/User/Ruby.sublime-settings +++ b/sublime2/User/Ruby.sublime-settings @@ -3,7 +3,8 @@ [ "podspec", "ru", - "Guardfile" + "Guardfile", + "rabl" ], "tab_size": 2, "translate_tabs_to_spaces": true diff --git a/zsh/prompt.zsh b/zsh/prompt.zsh index 86faa9e..4600ad0 100644 --- a/zsh/prompt.zsh +++ b/zsh/prompt.zsh @@ -2,17 +2,24 @@ autoload colors && colors # cheers, @ehrenmurdick # http://github.com/ehrenmurdick/config/blob/master/zsh/prompt.zsh +if (( $+commands[git] )) +then + git="$commands[git]" +else + git="/usr/bin/git" +fi + git_branch() { - echo $(/usr/bin/git symbolic-ref HEAD 2>/dev/null | awk -F/ {'print $NF'}) + echo $($git symbolic-ref HEAD 2>/dev/null | awk -F/ {'print $NF'}) } git_dirty() { - st=$(/usr/bin/git status 2>/dev/null | tail -n 1) + st=$($git status 2>/dev/null | tail -n 1) if [[ $st == "" ]] then echo "" else - if [[ $st == "nothing to commit (working directory clean)" ]] + if [[ "$st" =~ ^nothing ]] then echo "on %{$fg_bold[green]%}$(git_prompt_info)%{$reset_color%}" else @@ -22,12 +29,14 @@ git_dirty() { } git_prompt_info () { - ref=$(/usr/bin/git symbolic-ref HEAD 2>/dev/null) || return + ref=$($git symbolic-ref HEAD 2>/dev/null) || return +# echo "(%{\e[0;33m%}${ref#refs/heads/}%{\e[0m%})" echo "${ref#refs/heads/}" } unpushed () { - /usr/bin/git cherry -v @{upstream} 2>/dev/null + $git cherry -v `$git config --get branch.master.remote`/$(git_branch) 2>/dev/null + #$git cherry -v @{upstream} 2>/dev/null } need_push () {