Skip to content

Instantly share code, notes, and snippets.

@sirolf2009
Last active February 26, 2018 08:31
Show Gist options
  • Save sirolf2009/238086e0797854eb8bc8d977285c8e69 to your computer and use it in GitHub Desktop.
Save sirolf2009/238086e0797854eb8bc8d977285c8e69 to your computer and use it in GitHub Desktop.
fish
function commit
git status
git add --all
read commit_msg
git commit -m $commit_msg
git push
end
function fish_right_prompt --description 'Write out the right prompt, as the latest git commit author and message'
set -l is_git_repository (git rev-parse --is-inside-work-tree ^/dev/null)
if test -n "$is_git_repository"
set -l commit_message (git log -1 --pretty=%B)
set -l commit_author (git log -1 | sed -n 2p | sed '0,/Author: /{s/Author: //}')
echo -n "$commit_author $commit_message"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment