02.11.12

Git My Site

Posted in Uncategorized at 7:29 am by Toby

I have  a number of legacy sites I look after that are old enough to have not been created with any CMS system like Drupal, Joomla or CodeIgnitor, just good old fashioned code.

I like source code control software, I’ve used

  • Copy and Paste (We all start here)
  • VSS (the most hideous thing ever)
  • CVS (briefly)
  • Subversion (never really liked it)
  • Component Software RCS (My first pleasant SCC experience, Brilliant, but now a bit outdated)
  • Perforce (an absolutely brilliant main SC system, still my favourite and main SC tool)
  • fossil(interesting but a bit weird),
  • Mercurial (very briefly as part of the brillian fogbugz) and most recently
  • git (Brilliant in its own special way, and particuarily in conjunction with github)
  • I even wrote a very basic source control system in a place I once worked.

However despite having experience with almost 10 differnt source code control systems, I still end up using the wonderful Editpadpro to simply connect via ftp to these sites and make a quick little change live on the server.  If I need to do anything major I do it with Source Control, but for 2 line changes or to fix a bug I often do it online/on-production , despite breaking the cardinal rule of software.  The obvious problem here is when I introduce a problem, if I don’t catch it immediately its sometimes a bit tricky to figure out what I broke.

Now I have a solution.

My host (Dreamhost.com) has git installed on some of its servers.  I have written a simple php script called gitmysite that allows basic sc interaction on the server.  This is read only externally, and is not designed to be pushed to.  It is basically a simple change repository.  Now when I make a change via ftp or editpadpro, I can simply go to http://www.mysite.com/gitmysite.php and after logging in write a quick commit message – click a button and I have a record of what I changed.  It will add all files I changed across the entire site.  This is still in development so it is a bit rough at the moment, but take a look at it on github and send me any feedback you might have.

https://github.com/tobya/gitmysite

With the script you can

  • Create a git repo
  • Create a .gitignore file
  • Add all files in your site to repo
  • Add changed files and provide commit messages after changes.
  • View Status
  • View Log
There are various things you cant do for vague security reasons such as do a diff and run arbitrary git commands.  There are certain things like merging and branching you cant do because it doesnt make any sense in the situation that gitmysite is designed to be used.

Comments are closed.