Skip to content

Commit

Permalink
Add git fixup helper
Browse files Browse the repository at this point in the history
  • Loading branch information
tombruijn committed Jul 30, 2015
1 parent e15b231 commit b2c39d7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
21 changes: 21 additions & 0 deletions bin/git-fixup
@@ -0,0 +1,21 @@
#!/bin/zsh

amount=${1:-10}
array=(${(@f)"$(git --no-pager log -n $amount --pretty=format:%s)"})
for (( i = 1; i <= $#array; i++ )) do
key="$i"
if [[ $#i == 1 ]]; then
key=" $key"
fi
echo "$key $array[i]"
done

local choice
echo ""
read "choice?Commit to fixup?: "
if [[ "$choice" -le "0" ]]; then
echo "No commit given.. Exiting."
else
local commits_back=$(($choice - 1))
git commit --fixup HEAD~$commits_back
fi
1 change: 1 addition & 0 deletions install
Expand Up @@ -9,6 +9,7 @@ ln -nfs "$(pwd)/zsh/.zsh" "$HOME/.zsh"
ln -nfs "$(pwd)/.ruby-version" "$HOME/.ruby-version"

ln -nfs "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" "$HOME/.bin/sub"
ln -nfs "$(pwd)/bin/git-fixup" "$HOME/.bin/git-fixup"

SUBLIME_DIR="$HOME/Library/Application Support/Sublime Text 2/Packages/User"
ln -nfs "$(pwd)/sublime/Preferences.sublime-settings" "$SUBLIME_DIR/Preferences.sublime-settings"
Expand Down
2 changes: 1 addition & 1 deletion zsh/.zsh/aliases.zsh
Expand Up @@ -34,7 +34,7 @@ alias mou="open -a \"Mou.app\""
# Git
alias g="open -a gitx ."
alias gs="git status -sb"
alias gf="git commit --fixup"
alias gf="git-fixup"
alias gb="git branch"
alias gc="git checkout"
alias gm="git merge"
Expand Down

0 comments on commit b2c39d7

Please sign in to comment.