Last active
May 10, 2017 17:34
-
-
Save beefy/513c39f89fab527a51d9b0d7cbcc2db4 to your computer and use it in GitHub Desktop.
An alias to simplify git committing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
do_push() { | |
while true; do | |
read -p "ready to push? " yn | |
case $yn in | |
[Yy]* ) read -p "commit msg: " msg; git add . -A; git commit -m "$msg"; git push; break;; | |
* ) kill -INT $$;; | |
esac | |
done | |
} | |
check_diff() { | |
git diff; | |
git status -s; | |
git branch | grep "*"; | |
do_push; | |
} | |
alias push=check_diff | |
alias b='git branch | grep "*"' | |
alias branch='git branch' | |
alias diff='git diff' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I find myself running a lot of commands when I make a commit, so I made an alias to reduce typing and forgetfulness.
It checks the diff, then a list of the files changed, then the current branch, and if I decide to commit [y/n], it does git add, git commit, and git push.