]> Tony Duckles's Git Repositories (git.nynim.org) - dotfiles.git/blob - bin/git-cherry-view
.tmux.conf: UTF-8 settings are no longer needed
[dotfiles.git] / bin / git-cherry-view
1 #!/bin/sh
2 # Usage: git-cv <upstream> [<head> [<limit>]]
3 # Humane git-cherry view. Show commits not merged upstream
4 # like git-cherry with verbose output, short SHAs, and ANSI
5 # color.
6
7 for a in "$@" ; do
8 test "$a" = "--help" &&
9 exec git cherry --help
10 done
11
12 SHA=$(git config --get-color 'color.branch.local')
13 ADD=$(git config --get-color 'color.diff.new')
14 REM=$(git config --get-color 'color.diff.old')
15 RESET=$(git config --get-color '' 'reset')
16
17 git cherry -v "$@" |
18 cut -c1-9,43- |
19 sed -e "s/^\(.\) \(.......\)/\1 $SHA\2$RESET/" |
20 sed -e "s/^-/$REM-$RESET/" -e "s/^+/$ADD+$RESET/"