Skip to content

Instantly share code, notes, and snippets.

@EvgeneOskin
Last active August 29, 2015 14:22
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 EvgeneOskin/21a7b0fea77623963146 to your computer and use it in GitHub Desktop.
Save EvgeneOskin/21a7b0fea77623963146 to your computer and use it in GitHub Desktop.
#!/bin/bash
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
COMMIT_ARGS=""
PUSH_ARGS=""
if [[ " $@ " == *" --amend "* ]] || [[ " $@ " == *" -a "* ]]; then
COMMIT_ARGS="--amend"
fi
if [[ " $@ " == *" -f "* ]] || [[ " $@ " == *" --force "* ]]; then
PUSH_ARGS="--force"
fi
if [[ " $@ " != *" --no-add "* ]]; then
git add .
fi
git commit . $COMMIT_ARGS && git push origin $CURRENT_BRANCH $PUSH_ARGS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment