Using fbrp

January 17, 2009

FBRP is my rails starter application. When you base an application on it you need another git repository to push the application to. So I have to set up the application in a way that it can get updates from FBRP and yet still be independent.

Base and Master Branches

Most Git apps have a master branch. When you set up a new application from FBRP your master branch will be tied to FBRP. This is not desirable. So instead we create a ‘base’ branch for fbrp

gch -b base

Now we modify .git/config.

[remote "fbrp"]
	url = git://
	fetch = +refs/heads/*:refs/remotes/origin/*
[branch "base"]
	remote = fbrp
	merge = master

What this does is tie the base branch in our new application to the master branch of FBRP. Now when FBRP is update we can pull directly into the base branch

gch base
git pull

After that we can merge back into the master branch doing a rebase

gch master
git rebase base

Setting up local remote

We can clone our new project and put it on little-un. In the following our new project is ‘tc4’

git clone --bare tc4 tc4.git
scp -r tc4.git deploy@little-un:/srv/git

Now we remote into little-un and change permissions

sudo chown -R git:git /srv/git/tc4.git/

Finally we go back to our dev box and clone a new project

mv tc4 tc4.old
git clone git@little-un:/srv/git/tc4.git

If we do a

gb -a

We get

* master

If we wish to get updates from fbrp to our new clone we have to create a local base branch and update our .git/config as above

gch -b base

modify .git/config by adding

[remote "fbrp"]
	url = git://
	fetch = +refs/heads/*:refs/remotes/origin/*
[branch "base"]
	remote = fbrp
	merge = master

Now we should have

Branch | Push          | Pull 
------ | ------------- | ------
Base   | no            | yes (little-un) 
Master | yes (github)  | yes (little-un)

Initial Application Steps

  • database.yml
  • update session key in environment.rb
  • update application name and repo location in deploy.rb
  • create local database tables

Then migrate and run

rake spec
rake features