Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
with
23 additions
and 1 deletion.
- +21 −0 bin/git-fixup
- +1 −0 install
- +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 |