File tree Expand file tree Collapse file tree 7 files changed +26
-14
lines changed Expand file tree Collapse file tree 7 files changed +26
-14
lines changed Original file line number Diff line number Diff line change 11# git-extra-commands
22
3+ [ ![ License] ( https://img.shields.io/badge/License-Apache%202.0-blue.svg )] ( https://opensource.org/licenses/Apache-2.0 )
4+ [ ![ Build Status] ( https://travis-ci.org/unixorn/git-extra-commands.svg?branch=master )] ( https://travis-ci.org/unixorn/git-extra-commands )
5+ [ ![ Code Climate] ( https://codeclimate.com/github/unixorn/git-extra-commands/badges/gpa.svg )] ( https://codeclimate.com/github/unixorn/git-extra-commands )
6+ [ ![ Issue Count] ( https://codeclimate.com/github/unixorn/git-extra-commands/badges/issue_count.svg )] ( https://codeclimate.com/github/unixorn/git-extra-commands )
7+ [ ![ GitHub stars] ( https://img.shields.io/github/stars/unixorn/bigriver-tools.svg )] ( https://github.com/unixorn/bigriver-tools/stargazers )
8+
39A zsh plugin that packages some extra git helper scripts I've found. I only wrote a few of these scripts, and the ones I didn't each have whatever licensing is included in the file.
410
511This collection doesn't actually require zsh, but packaging it as a ZSH plugin makes it more convenient for people using a ZSH framework to use this collection.
Original file line number Diff line number Diff line change 22#
33# https://github.com/cofi/dotfiles/blob/master/bin
44
5- git log --pretty=format:' %an <%ae>' $1 | sort | uniq -c | sort -nr
5+ exec git log --pretty=format:' %an <%ae>' " $1 " | sort | uniq -c | sort -nr
Original file line number Diff line number Diff line change @@ -147,4 +147,4 @@ if [[ -e .git/refs/original/ ]] ; then
147147 git " for-each-ref" --format=" %(refname)" refs/original/ | xargs -n 1 git update-ref -d
148148fi &&
149149git reflog expire --expire=now --all &&
150- git gc --prune=now
150+ git gc --prune=now
Original file line number Diff line number Diff line change 55#
66# https://plus.google.com/115587336092124934674/posts/dXsagsvLakJ
77
8- git branch -d ` git branch --merged | grep -v ' ^*' | tr -d ' \n' `
8+ # shellcheck disable=SC2046,SC2063
9+ exec git branch -d $( git branch --merged | grep -v ' ^*' | tr -d ' \n' )
Original file line number Diff line number Diff line change @@ -15,4 +15,4 @@ if [[ "${currentBranch}" != "${mergedInto}" ]]; then
1515 exit 1
1616fi
1717
18- git branch --merged ${mergedInto} | grep -v " \* ${mergedInto} " | xargs -n 1 git branch -d
18+ git branch --merged " ${mergedInto} " | grep -v " \* ${mergedInto} " | xargs -n 1 git branch -d
Original file line number Diff line number Diff line change 1212
1313if [ " $1 " ]
1414then
15+ # shellcheck disable=SC2046,SC2143
1516 if [ ! $( echo " $1 " | grep -E " ^[0-9]+$" ) ]
1617 then
1718 echo " $1 is not a number."
2728 echo " Usage: git move-commits <num-commits> <correct-branch>" ;
2829 exit 1;
2930fi
30- if [ -z $2 ]
31+ if [ -z " $2 " ]
3132then
3233 echo " Usage: git move-commits <num-commits> <correct-branch>" ;
3334 exit 1;
3435else
35- BRANCH=$2
36+ BRANCH=" $2 "
3637fi
3738
38- CURRENT_BRANCH=` git branch | grep ' *' | perl -e ' <STDIN> =~ /^..(.+)$/;print $1' `
39+ # shellcheck disable=SC2063
40+ CURRENT_BRANCH=$( git branch | grep ' *' | perl -e ' <STDIN> =~ /^..(.+)$/;print $1' )
3941
4042# If the branch already exists, we have to merge it with the current branch
41- if ! [ -z ` git branch -a | grep $BRANCH ` ]
43+ # shellcheck disable=SC2143,SC2046
44+ if ! [ -z $( git branch -a | grep " $BRANCH " ) ]
4245then
4346 echo " $BRANCH already exists. Switching to it and merging $CURRENT_BRANCH "
44- git checkout $BRANCH
45- git merge $CURRENT_BRANCH
47+ git checkout " $BRANCH "
48+ git merge " $CURRENT_BRANCH "
4649else
4750 echo " Creating $BRANCH "
48- git branch $BRANCH
51+ git branch " $BRANCH "
4952fi
50- git reset --hard $CURRENT_BRANCH ~$NUM_COMMITS
51- git checkout $BRANCH
53+ git reset --hard " $CURRENT_BRANCH ~$NUM_COMMITS "
54+ git checkout " $BRANCH "
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ inplace=0
2424ext=" .bak"
2525
2626message () { printf " %s\n" " $1 " >&2 ; }
27+ # shellcheck disable=SC2104
2728skip () { message " skipping ${2:- $file }${1: +: $1 } " ; continue ; }
2829argerr () { printf " %s: %s\n" " $myname " " ${1:- error} " >&2 ; usage 1 ; }
2930invalid () { argerr " invalid option: $1 " ; }
@@ -102,6 +103,7 @@ for file in "${files[@]}"; do
102103
103104 if (( inplace)) ; then
104105 outfile=$( mktemp) || skip " could not create temporary file"
106+ # shellcheck disable=SC2064
105107 trap " rm -f -- '$outfile '" EXIT
106108 cp " $file " " $outfile " || skip
107109 exec 3> " $outfile "
@@ -125,4 +127,4 @@ for file in "${files[@]}"; do
125127 trap - EXIT
126128
127129 if (( verbose)) ; then message " resolved ${file} " ; fi
128- done
130+ done
You can’t perform that action at this time.
0 commit comments