by alzamixer · 1y ago · 0 comments
```plaintext name=../../bin/assisted-commit
#!/bin/bash
# Run git commit with --verbose --dry-run and save the output git commit --verbose --dry-run > ./commit.message
# Prepend # to every line and add "conventional commit message:" at the end sed -i 's/^/# /' ./commit.message echo "# uncommented conventional commit message using feat, fix or doc flags. !beakingchange iff change breaks backward compatibility:" >> ./commit.message echo "" >> ./commit.message
# Open the file in vim for editing, with cursor on a new line at the end and in insert mode vim +':normal Go' +startinsert ./commit.message
# Filter out commented lines and save to a temporary file grep -v '^#' ./commit.message > ./commit.message.filtered
# Commit using the filtered file git commit -F ./commit.message.filtered
# Delete the files rm ./commit.message ./commit.message.filtered
```
No comments yet.