Simple git example (remote repository)

In the last example we were working with a purely local repository. This example shows you how to work with remote repositories.

We’re going to convert the local repository we previously created in to a “bare” repository, this is a repository we can easily do “pushes” and “pulls” from (like commits and updates in svn). Once you’ve done this you won’t use this central repository to work on directly, it’ll just be where everything is stored.

0. On your “server”, convert the repository to be a “bare” repository.

cd testproject
git config --bool core.bare true

1. On your client “clone” (checkout in svn nomenclature) the repository.

This depends on how you’re accessing the repository but if it’s over ssh you can do this:

git clone ssh://[email protected]/home/myuser/testproject

2. Create a file and push it (commit in svn nomenclature):

touch remotetest
git add remotetest
git commit remotetest
git push

3. Pull the latest version (update in svn nomenclature):

git pull

Why shared development environments are a bad idea

Advantages:

  • You only need to administrate a single box.
  • You can buy a big server, and users can take advantage of this for sporadic compute intensive jobs like compiling.

Disadvantages:

  • It introduces a single point of failure, if the server goes offline no one can work.
  • Users don’t have the freedom to use there own software. Users can’t always select the version of a tool they need.
  • It doesn’t scale. As more users are added you need a bigger and bigger server. Eventually you need to add more servers (so why not just give each developer a desktop?).
  • When a user deletes a file the whole server needs to be taken offline (yes this happened).
  • Users developing software that needs access to a system resource (e.g. a web server running on port 80) may not be able to get exclusive access to that resource.
  • Performance analysis becomes more problematic when other software is performing IO/memory access etc.. It’s not possible to isolate this on a shared system.
  • If you have a tool which requires root, it becomes a security risk to give users access to that tool.
  • If a user is taxing the system they can slow down other users tasks (particularly in the case of IO intensive work.

Simple git example (local repository)

0. Configure your information:

git config --global user.name "Mr User the user"
git config --global user.email "[email protected]"

You can also configure an editor:

git config --global core.editor 'vim'

1. Create a repository

mkdir testproject
cd testproject
git init

2. Commit a file

touch testfile
git add testfile
git commit

3. Making a release branch

git branch RB_1.0 master

While you’ve created a release branch, you’re still currently on the master branch. So if you make a change here:

touch testfile2
git add testfile2
git commit

That file will NOT be in the release branch (RB_1.0).

4. Switching between the master branch and the release branch.

Unlike, SVN which stores different branches in different directories, git uses a command to switch your directory between branches. Slightly confusingly this command is called “checkout”.

git checkout RB_1.0

If you want, you can make changes to RB_1.0, they wont be refected elsewhere.

touch rb1file
git add rb1file
git commit

5. Releasing

Create a tag:

git tag 1.0 RB_1.0

List all tags:

git tag

6. Merging

Merge changes from RB_1.0 on to master:

git checkout master
git rebase RB_1.0

7. Delete a branch

It seems to be git practice to delete branches, you can always branch from the tag.

git branch -d RB_1.0

8. Creating a tarball

git archive --format=tar --prefix=testproject1 1.0 > ~/testproject1.tar

9. Changing a file!

This may be slightly different than you were expecting. You can’t just edit the file and type “git commit” rather, you need to add then commit. For example, after editing testfile:

git add testfile
git commit

Git creates commits in two stages like this. The first add “stages” the change and commit commits it. You can do multiple adds before the commit. The idea is to let you get everything organised before finally performing the commit.

Notes on git

There are no version numbers. A revision is identified by its hash.

master is like trunk in SVN/CVS.

checkout, doesn’t really mean checkout. It mean switch between branches.

You can also branch from tags the same way you branch from master.

Brain Wave Synchroniser

I saw this Brain Wave Synchroniser in the Oxford Museum of the History of Science today. It’s an early ancestor of machines like the brain machine. It was manufactured in 1965 by Schneider Instruments. The whole area of brainwave entrainment seems to be more active than I realised. There’s some more information about the device here and here. I particularly like the fact that it can be used for “group induction”. The full advert reads as follows:

The Brain Wave Synchronizer

Thirty years of research have been put into this amazing unit. WHAT THIS UNIT DOES FOR YOU:

* Lessen Resistance
* Increase Suggestibility
* Reduce Induction Time to seconds.
* Deepen Hypnosis to the level you select.
* Use for Altered States of Consciousness instantly.
* Induces Healing States. Programs Mind state & MUCH MORE!!

HOW IT WORKS:

The principle of photic stimulation has been known since 1934, but it wasn’t until the work of Sidney Schneider on Radar Systems in World Ware II that its relation to hypnosis was discovered. Schneider noticed the effect that mathematically timed and shaped light pulses had on the Radar operators and applied the theory to develop the Brain Wave Synchronizer. The goal was to produce the rate of the natural brain rhythm. Whe the pattern of the light is tuned tot he subject’s own frequency, repose to hypnotic induction is rapid, easy and effective! Because of its automatic functions. The Synchronizer gives the beginner the same advantage as the professional hypnotist! The uses are unlimited! Other machines cost hundreds more and give much less results. This is the “STATE OF THE ART” model for the serious researcher or trance inducer. Why waste hours getting to “higher States” of consciousness. DO IT ALMOST INSTANTLY AND GET TO STATES MUCH DEEPER THAN YOU COULD WITHOUT THIS DEVICE.

* Single frequency control cover the four major brain ranges
* 30 minute electronic timer
* Wired remote control will Start, Stop, Tune and Time, up to 10 feet.
* Can be used for individual or group induction.
* Safe and very easy to use. No attachment to subject.
* No moving parts. ALL Photo-Electronic
* Range 1-30 pulses er second in 4 ranges: Delta, Theta, Alpha, Beta. Comes with complete instructions and one year factory service warranty.
* Audio tape instructions available for $10.00 extra.

Member Price: $480.00 & $18.00 S&H Non-Member Price $498.00 & $18.00 S&H