Wednesday, November 4, 2015

GIT Merge Tool : Very Basic

#!/usr/bin/env bash
git branch -vvv;
echo "intergration branch:"
read int
echo "branch to merge:"
read mergebranch
git checkout $int && git merge --no-edit --no-ff $mergebranch
# example:  git checkout lm/generalLake && git merge --no-edit --no-ff origin/lm/ottersSwim

MySQL Count Duplicates

#!/usr/bin/env bash
echo "Table to read:"
read table
echo "Column to count and display:"
read col
echo "Threshold number:"
read num
echo "SELECT $col FROM $table GROUP BY $col HAVING count(*) > $num;";

Useage

Table to read: geocodes Column to count and display: ip Threshold number: 2 SELECT ip FROM geocodes GROUP BY ip HAVING count(*) > 2;

GIT Checkout Loop

#!/usr/bin/env bash



while true
do
 git fetch --prune; 
        git branch -vvv
 echo "provide branch name to checkout:"
 read branch
        git checkout $branch;
        git pull;
        git log --decorate --pretty=tformat:'%h %d %ar %s' --first-parent --reverse -30;
        git log -1
 $1  # arg to import a command, such as 'exit'
done

Monday, November 2, 2015

GIT Log Search Source Script

#!/usr/bin/env bash
# this.is.lance.miller@gmail.com
regex="$2*$3*$4"
clear
echo "useage"
echo "$0 2 foo fab fangs"
echo "2 is the number of results"
echo  "foo fab fangs are the search terms. wildcards are placed in between them"
echo "press [Enter] to proceed"
read
echo "search string is: $regex"
for i in `git log -$1 --decorate --pretty=tformat:'%h %d %an %ar %s' --source --all -i -G $regex | cut -d" " -f1`;
do
 echo $i
 git show $i
done
exit

Use Example

searchGIT.sh 2 foo fab fangs
2 is the number of results
foo fab fangs are the search terms. wildcards are placed in between them