Last active
January 14, 2019 02:10
-
-
Save peabnuts123/91e993df2d1ede07d19f95cd2e36f0ed to your computer and use it in GitHub Desktop.
Small function to show local git changes and prompt whether you want to push
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
# Usage: git-prompt (when in a git repo) | |
# Print the output of `git status` then prompt the user for whether | |
# they wish to `git push` | |
function git-prompt() { | |
git log "origin/$(git rev-parse --abbrev-ref HEAD)"..HEAD | |
echo '------------------------------------------'; | |
git status --untracked-files no; | |
echo '------------------------------------------'; | |
while true; do | |
read -rp "Do you wish to run \`git push\`? " yn | |
case ${yn} in | |
[Yy]* ) git push; break;; | |
[NnQq]* ) break;; | |
* ) echo "Please answer Y or N.";; | |
esac | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment