introduction
New users to git and Heroku sometimes have trouble with the syntax and arguments of the git commands required to deploy an application to Heroku. This wrapper combines the git add, commit, and push commands.
The command has no arguments. The user is prompted for a commit message. The wrapper contains no error handling, so the user will receive standard errors from git.
installation
If you have a Gemfile, add gittyup. Otherwise, install it like this:
$ gem install gittyup
usage
typical usage:
$ gittyup
enter commit message (blank to exit)> New site title
[master 318bd11] New site title
1 files changed, 2 insertions(+), 0 deletions(-)
wait for push to start, then
lots of messages from Heroku
until the push ends like this
To git@heroku.com:awesomeproject.git
13f987c..aceaf78 master -> master
$
detailed operation
All code is in bin/gittyup. An error from any system command causes the script to exit.
Since the script is designed for beginning users, it assumes you are committing to and pushing the master branch. If you know enough to have multiple branches, you probably don't need this script.
The script performs these steps:
-
git status
If this command fails, the current directory is probably not a git repository. -
git status
If this command provides no output, then there are no changed files to commit. -
git add --all
Add new, changed, and removed files to the index. - Prompt the user for a commit message. If no message is entered, the script exits.
-
git commit --message <message>
Record changes to the repository. -
git push heroku master
Deploy the updated repository to Heroku.
For every system command performed, the exit status of the
operation is passed back via exit $?.exitstatus
. That status is
used by the tests.
tests
A nicely formatted test suite is available at Relish.
To run the tests:
$ cd gittyup
$ bundle
$ rake
contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request