Guest User

Untitled

a guest
Feb 21st, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. git cherry -v HEAD $1 | grep ^+ | while read line; do
  4. hash=`git rev-parse --short $( echo "$line" | cut -d' ' -f2 )`
  5. description=$( echo "$line" | cut -d' ' -f3- | cut -c 1-64 )
  6. conflict=$( git cherry-pick -n $hash 2> /dev/null | grep 'CONFLICT' )
  7. status=$( git status )
  8. if ! current_git_status=$( echo "$status" | grep 'working directory clean' ); then
  9. if [ "$conflict" ]; then
  10. num_conflicting_files=$( echo "$status" | grep 'unmerged: ' | wc -l | sed 's/ //g' )
  11. num_conflicts=$( git diff | grep '++=======' | wc -l | sed 's/ //g' )
  12. printf "+ \033[01;31m$hash\033[00m %1d %2d %s\n" "$num_conflicting_files" "$num_conflicts" "$description"
  13. else
  14. printf "+ \033[01;32m$hash\033[00m $description\n"
  15. fi
  16. git reset --hard > /dev/null
  17.  
  18. #else echo "- $hash $description"
  19.  
  20. fi
  21. done
Add Comment
Please, Sign In to add comment