Permalink
Browse files

Add git fixup helper

  • Loading branch information...
tombruijn committed Jul 30, 2015
1 parent e15b231 commit b2c39d7d408f90c08bc8fe5b3d6c82793fa6b159
Showing with 23 additions and 1 deletion.
  1. +21 −0 bin/git-fixup
  2. +1 −0 install
  3. +1 −1 zsh/.zsh/aliases.zsh
@@ -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
@@ -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"
@@ -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"

0 comments on commit b2c39d7

Please sign in to comment.