Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # $1 -- [optional] custom commit author
- fart () {
- git add .
- RETVAL=$?
- if [ $RETVAL -ne 0 ]; then
- echo 'Some shit happened! (git add .)' 1>&2
- return $RETVAL
- fi
- git status
- RETVAL=$?
- if [ $RETVAL -ne 0 ]; then
- echo 'Some shit happened! (git status)' 1>&2
- return $RETVAL
- fi
- echo 'Enter your commit message or leave it empty if you did something wrong.'
- echo -n 'Commit message: '
- read msg
- local clear_msg=$(echo "$msg" | sed -e 's/\(^\s\+\|\s\+$\)//g')
- if [ "x$clear_msg" == "x" ]; then
- echo 'Commit is cancelled (because commit message is empty)' 2>&1
- return 1
- else
- if [ "x$1" == "x" ]; then
- git commit -m "$clear_msg"
- else
- git commit -m "$clear_msg" --author="$1"
- fi
- return $?
- fi
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement