Skip to content

Instantly share code, notes, and snippets.

@hlung
Last active November 6, 2019 07:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hlung/e94911bf5e5a4320eaca11100d22922a to your computer and use it in GitHub Desktop.
Save hlung/e94911bf5e5a4320eaca11100d22922a to your computer and use it in GitHub Desktop.
Do git add and commit with auto generated message. For laziness reasons πŸ˜‚.
# Do git add and commit with auto generated message. For laziness reasons πŸ˜‚.
# It simply reads `git status -s`, converts the beginning M -> Update, A -> Add, and D -> Delete, and use it as a commit message.
# Example:
# git status: M updated.txt
# generated message: Update updated.txt
#
# For debugging sed part:
# echo "M updated.txt\nA added.txt\nD deleted.txt\nR events/BaseEvents.yml -> events/AppEvents.yml" | sed "s/^M /Update/;s/^A /Add/;s/^D /Delete/;s/^R /Rename/;s/->/to/"
alias gaca='git add .; git status -s | sed "s/^M /Update/;s/^A /Add/;s/^D /Delete/;s/^R /Rename/;s/->/to/" | git commit --file -'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment