Skip to content

Commit

Permalink
Improve workflow tools
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Wirth committed Sep 25, 2018
1 parent d4f9d97 commit c81a83c
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 27 deletions.
27 changes: 27 additions & 0 deletions rebase.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
function rebase () {

if [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]] || [[ "$1" == "" ]]; then
echo "usage: rebase [base [top]]"
echo "where [top] defaults to the current branch"
return
fi

START=`currentBranch`

TOP=$2
BASE=$1
echo maybe $TOP
# fall back if second arg is not defined
if [[ "$2" == "" ]];
TOP=$START
if
echo yes $TOP
echo rebasing $TOP onto $BASE

git checkout $BASE
git pull
echo checking out $TOP
git checkout $TOP
git rebase $BASE
git checkout $START
}
25 changes: 25 additions & 0 deletions rgki.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/zsh

MAX_HITS=30

YELLOW=`tput setaf 3`
WHITE=`tput setaf 7`

function rgki () {
local counter=1
# populate array with the first MAX_HITS hits
hits=("${(@f)$(rg -l $1 | tail +2 | head -n $MAX_HITS)}");

# print file list with newline before and after
printf "\n"
for hit in "${hits[@]}";do
echo ${counter}$YELLOW ${hit} $WHITE
counter=$((counter+1))
done

printf "\nwhich file? "

# get the file by number
read whichfile
kak ${hits[$whichfile]}
}
33 changes: 6 additions & 27 deletions zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -179,33 +179,12 @@ function gcol {
}


function rebase () {

if [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then
echo "usage: rebase [base [top]]"
echo "where [top] defaults to the current branch"
return
fi

START=`currentBranch`

TOP=$2
BASE=$1
echo maybe $TOP
# fall back if second arg is not defined
if [[ "$2" == "" ]];
TOP=$START
if
echo yes $TOP
echo rebasing $TOP onto $BASE

git checkout $BASE
git pull
echo checking out $TOP
git checkout $TOP
git rebase $BASE
git checkout $START
}


source ~/dotfiles/pomodoro/pomodoro.sh
source ~/dotfiles/rgki.sh
source ~/dotfiles/rebase.zsh

alias work="pomo && pomo -s"

alias gitrefine="git rebase -i HEAD~10"

0 comments on commit c81a83c

Please sign in to comment.