Putting teemlabs Under Git
Yesterday, I blogged about my adventure with Google App Engine and the 'launch' of teemlabs.
I knew that I had to maintain the source code of this app, and that meant creating a Git repository. The thing was, I didn't know, and still don't, if the .git directory will be uploaded to the Google servers when I deploy the application. (I have an update at the end of this post regarding this.) I don't want that. I thought of putting the main application directory inside another directory which would contain the .git directory, making the parent directory the root of the Git repository.
|--teemlabs.git
|--.git
|--teemlabs <-- the app
I thought I knew what to do, but I encountered a problem creating the git repository.
Here's what happened.
~/dev/projects/appengine/teemlabs$ git init
Initialized empty Git repository in .git/
~/dev/projects/appengine/teemlabs$ mate .gitignore
~/dev/projects/appengine/teemlabs$ gst
# On branch master
#
# Initial commit
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# .gitignore
# teemlabs/
nothing added to commit but untracked files present (use "git add" to track)
~/dev/projects/appengine/teemlabs$ git add .
~/dev/projects/appengine/teemlabs$ git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
# (use "git rm --cached <file>..." to unstage)
#
# new file: .gitignore
# new file: teemlabs
#
~/dev/projects/appengine/teemlabs$ git commit -m "Initial commit."
Created initial commit 25936f1: Initial commit.
2 files changed, 3 insertions(+), 0 deletions(-)
create mode 100644 .gitignore
create mode 160000 teemlabs
~/dev/projects/appengine/teemlabs$
I then copied teemlabs to my slice, and git cloned the new repository. Yup, it was cloned... except that the files under teemlabs/teemlabs weren't there.
Why? Didn't git add . add the teemlabs directory? Well, yes. It did add the teemlabs directory-- but only the directory. The files inside weren't added.
So I added them.
~/dev/projects/appengine/teemlabs$ git add teemlabs/*
~/dev/projects/appengine/teemlabs$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# deleted: teemlabs
# new file: teemlabs/app.yaml
# new file: teemlabs/templates/index.html
...
~/dev/projects/appengine/teemlabs$ git commit -m "Add the teemlabs files."
Created commit 3c493b6: Add the teemlabs files.
14 files changed, 177 insertions(+), 1 deletions(-)
delete mode 160000 teemlabs
create mode 100644 teemlabs/app.yaml
create mode 100644 teemlabs/index.yaml
...
Now, all is well and good. Cloning the repo included the files.
But it took two commits just to add a single directory. This shouldn't be the case. Adding a new directory and the files it contains can simply be done with the following steps.
git add directory
git add directory/*
git commit
I'm confused, though, why sometimes just a simple git add . and git commit works, but this time, it doesn't.
Oh, well.
Update:
After reading more of the docs, I found out that app.yaml has a skip_files element which allows you to skip uploading of files. And Unix hidden files are, by default, not uploaded. I didn't have to create a parent directory, which acts as the root of the git repo, for teemlabs. I could simply run git init in the teemlabs directory itself.
Originally published at http://devblog.timmedina.com/2008/5/30/put...



