Last active
August 29, 2015 14:02
-
-
Save rozzy/8cb8ee5792f97ed123fc to your computer and use it in GitHub Desktop.
Made a really useful git auto commit function in Bash. (run w/o .sh extension)
This file contains 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
function mkd () { | |
mkdir -p "$@" && cd "$@" | |
} | |
function slow_internet() { | |
sudo ipfw pipe 1 config bw 128Kbit/s delay 200ms && sudo ipfw add 1 pipe 1 src-port 80 | |
} | |
function get_file_size () { | |
ls -lah $@ | awk '{ print $5}' | |
} | |
function flush_internet () { | |
sudo ipfw flush | |
} | |
function commit () { | |
if [[ -f commit_settings.rb && ! -z $(git status -s) ]]; then | |
# echo "Executing commit_settings.rb:\n" | |
ruby commit_settings.rb | |
# echo "\n===\n" | |
# git rm commit_settings.rb | |
fi | |
if [[ ! -z $(git status -s) ]] then | |
echo "\e[0;31mGit Status:\e[0;m\n" && git status && git add -A && echo "\n\n\e[0;31mGit Commit:\e[0;m\n" | |
if [[ -n "$@" ]] then | |
git commit -m "$@" | |
elif then | |
git commit -m "Auto-commit. Previous: $(git rev-list --max-count=1 HEAD)" | |
fi | |
elif then | |
git status | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment