Skip to content

Instantly share code, notes, and snippets.

@astashov
Created August 19, 2009 08:17
Show Gist options
  • Save astashov/170245 to your computer and use it in GitHub Desktop.
Save astashov/170245 to your computer and use it in GitHub Desktop.
Creates/synchronizes new repo in the same parent dir with submodules tracked in the main tree and push the repo to Heroku
#!/bin/bash
current_dir=`pwd`
heroku_dir="${current_dir}_heroku"
function rsync_repo {
# Add trailing slash to source directory to avoid recreating it into $heroku_dir
rsync -r --exclude .git/ ${current_dir}/ $heroku_dir
}
# If $heroku_dir is directory and existed directory
if [ -d $heroku_dir ]; then
rsync_repo
cd $heroku_dir
git add .
git ci -m "Another commit"
git push heroku master
else
mkdir $heroku_dir
rsync_repo
cd $heroku_dir
git init
git add .
git ci -m "Initial commit"
heroku create
git push heroku master
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment