GIT Distributed Version Control 2

Posted by John Mon, 12 May 2008 21:59:00 GMT

Get with,

sudo aptitude install git-core

Simple Commands,

git init                   ...init repository
git add .                  ...add everything in dir to repository
git commit -a -m 'update'  ...add + commit changes
git diff                   ...show changes since last commit

git add [file]             ...add file
git rm [file]              ...remove file
git mv [file]              ...move file

Mirror Git Repository

rsync -azvCL --delete --progress 
   -e "ssh -i /home/[user]/.ssh/[mykey]" .git/* 
[user]@[user].strongspace.com:/home/[user]/[project]/.git/

Installing SVN via MacPorts

Posted by John Wed, 23 Jan 2008 20:57:00 GMT

Following on from my previous article concerning using MacPorts to install system software easily on your Mac, in this article I’ll guide you thru install Subversion and all it’s dependencies under Apple’s Leopard O/S.

Update MacPorts

First off you don’t have to install MacPorts with Leopard as it comes pre-installed, but you do need to update it.

So in Terminal run…

sudo port -v selfupdate

Perfect that should update the stock 1.5 build to the latest 1.6 release.

SVN Dependencies

Now to installing Subversion’s dependencies, without these Subversion will not build. So in Terminal run…

sudo port install sqlite3
sudo port install apr-util
sudo port install neon

Excellent, you should now be ready to install Subversion 1.4.6 from source via MacPorts

Finally Subversion

Just run…

sudo port install subversion

Should install ok leaving you with the latest binary build of Subversion on your Apple machine.

What about a GUI ?

Ok, as most people don’t really like using SVN from the command-line, you can download a mac gui interface to it at…

More MacPorts are available at…

Handy Tip

Before I go you can find out the location of a piece of software via the ‘which’ command.

which svn

Should return the path where it’s installed.

Remove .SVN directories

Posted by John Mon, 17 Dec 2007 21:08:00 GMT

Quick little command, run this inside a directory to remove any .svn directories within it recursively.

find . -name .svn -print0 | xargs -0 rm -rf

Thanks goes to Sitening

Tuning your SVN Deployment

Posted by John Thu, 23 Aug 2007 15:54:00 GMT

One of the problems you may run into with a project that has been deployed with SVN is choosing what it should ignore so that the production app does not fall over itself.

E.g. accidentally putting log files under version control and then deploying them to the server knowing your box will alter these over time.

So how can you get around this, pretty simple really; but first off try the following commands…

Reverting a Directory

svn revert log/*

This basically tells svn to revert everything in the log directory to it’s previous state.

Ignoring .log files

svn propset svn:ignore ".log" log

This tells svn to ignore any .log files within the log directory, so the log files generated on your production box aren’t the ones from your laptop.

Ignoring mongrel .pid’s

svn propset svn:ignore ".pid" pid

This like the command above will ignore the .pid files generated on your laptop, not taking these to your production box.

Ignoring the contents of a Directory

To go one step more, how about when you want the entire contents of a directory ignored from SVN. So say the photos generated on your production box don’t get overwritten from your development laptop.

svn propset svn:ignore '*' photo

Enjoy,

Subversion or SourceSafe ?

Posted by John Sat, 04 Aug 2007 18:21:00 GMT

In the avenue of Software Version Control and Agile Technologies there are two competing technologies, open-source Subversion SVN and Microsoft SourceSafe 2005 (now Team System).

But which is which and what benefits does each offer?

Subversion

Subversion in it’s essence is open-source so is perfectly suited for LAMP (Linux, Apache, MySQL, PHP) projects. It is uniquely flexible and simple to apply to any medium type or operating system, with easy integration to Windows via the TortoiseSVN software add-on.

It allows you to import, commit, export and differentiate successive code releases down to their line numbers really easily.

Also being in the public domain, the source-code is frequently updated and bugs fixed rapidly due to the larger exposure of it’s code-base.

Microsoft SourceSafe

Very similar to Subversion, it has been designed as a source-code cataloging and version control tool primarily for .NET / Visual Studio projects; and thus it’s flexibility ends there. It does however allow you to set aside a server as your primary project Source center and drill down to key changes in code, much like SVN.

People however have complained about a long-running database corruption issue within but this should be fixed.

So Which ?

Well the tight integration into the VS.NET IDE environment is a definite plus and on top of this SourceSafe gives you a database and Vault repository in which it keeps track of code changes; however the O/S inflexibility and more importantly the new VS.NET Team System pricing does put it out of scope for small businesses and independent startups.

It really is like my dad says ‘horses for courses’, SS maybe good in a Microsoft-Only environment, but SVN maybe better for independent startups and projects where flexibility and O/S independence are vital.

Really down to you, I know this isn’t that detailed a guide but should give you some idea as to which to choose.

What do I use ?

In reality I employ both,

For my Ruby on Rails projects I use a mixture of Capistrano, Deprec capped to a SubVersion repository on the Linux server. Works well as my development machine for that is an Apple Mac.

Workwise, I employ Subversion + TortoiseSVN to keep catalogued and protected all my web script files and xhtml micro-sites, with the repositories kept on a protected remote server.

However all my VS.NET applications are kept under SourceSafe control, hooked up to a remote server in another office; used by other developers.

Works quite well, the quick-install nature of SVN would allow me to get up-to-speed from a stolen laptop really fast (if another machine existed on standby). VS.NET would take longer but then that comes with the territory, but could be faster if you had a disk-image on standby with a carbon-copy of your development system setup.

Your choice.

John.