Chaos's git workflow - ManvilleFog/buttonmen GitHub Wiki

This is very rough --- it's just my (Chaos's) notes for what i do on git, vagrant, and pagoda to take various testing and development actions. Feel free to ask me if you have any questions.

Git directories i use:

~/src/git/cgolubi1: all dirs pulled from [email protected]:cgolubi1/buttonmen.git:
  buttonmen-something: branch named something (including something=master)
~/src/git/buttonmen-dev: all dirs pulled from [email protected]:buttonmen-dev/buttonmen.git:
  buttonmen-something: branch named something (including something=master)

How to test someone else's commit:

  • Update pulltest branch:
cd ~/src/git/cgolubi1/buttonmen-pulltest
git status   # make sure it's clean
git pull upstream master
git pull <whatever the merge e-mail says to pull>
  • Test on pagoda:
git push pagoda pulltest

Then browse to https://dashboard.pagodabox.com/apps/cgolubi1-buttonmen

  • choose the "pulltest" branch
  • click "deploy latest"
  • Test using vagrant:
cd deploy/vagrant
vagrant up
vagrant ssh
cd /buttonmen/src
php /usr/local/etc/buttonmen_phpunit.php /buttonmen/test
  • When finished testing:
vagrant destroy
  • IF the testing was unsuccessful:
git log   # find the commit which is the head of upstream now
commitid=<that commit>
git reset --hard $commitid
git push pagoda pulltest --force

Then browse to pagoda as above

How to check out a new branch:

  • update local master:
cd ~/src/git/cgolubi1/buttonmen-master
git status   # make sure it's clean
git pull upstream master
git push origin HEAD
Browse to:
  https://github.com/cgolubi1/buttonmen
Click "branch: master", type new branch name in box, then click create
branch=<branch name>  # N-desc for a ticket
cd ~/src/git/cgolubi1
git clone [email protected]:cgolubi1/buttonmen.git buttonmen-$branch
cd buttonmen-$branch
git remote add upstream [email protected]:buttonmen-dev/buttonmen.git
git branch $branch origin/$branch 
git checkout $branch

How to do my own development:

# Update both branches from upstream
branch=<some useful branch>
cd ~/src/git/cgolubi1/buttonmen-$branch
git pull upstream master
git push origin HEAD

<make and commit local changes>

# When ready to commit
cd ~/src/git/cgolubi1
cd buttonmen-$branch
git commit
git push origin HEAD
Browse to https://github.com/cgolubi1/buttonmen/tree/$branch
Click "Pull Request" and follow the instructions

How to setup master to push to AWS

cd ~/src/git/buttonmen-dev
git clone [email protected]:buttonmen-dev/buttonmen.git buttonmen-master
cd deploy/vagrant
./setup_aws_vagrantfile
vagrant up --provider=aws

How to update the AWS installation

cd ~/src/git/buttonmen-dev/buttonmen-master
mv deploy/vagrant/Vagrantfile{.orig,}
git status   # make sure it's clean except for deploy/vagrant/.vagrant
git pull origin master
cd deploy/vagrant
./setup_aws_vagrantfile
* Is a database reload needed?
  * IF so:
vagrant destroy
vagrant up --provider=aws
  * otherwise:
vagrant reload
* once vagrant is done, browse to
    https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#Addresses:
  and resync IP address to instance

Figure out what version AWS is running:

* ssh to alpha.buttonweavers.com
cat /buttonmen/.git/FETCH_HEAD