Installing latest git on Ubuntu with git-subtree support

Installing latest git on Ubuntu with git-subtree support

Recently I found it necessary to join two git repos together while still maintaining history & future ability to split or rejoin them.  Enter the ‘git subtree‘ command.

Because this command is now merged into git-core since 1.7.11, we will need to install the latest git from a PPA.  Note that as of ‘now‘, the latest available package from the PPA we will use is 1.8.0, and it currently installs the subtree script to /usr/share/doc/git/contrib/subtree. However, since the Makefile there expects asciidoc.conf to be in ../../Documentation/asciidoc.conf, we must checkout the source package & make from there.

I am using Ubuntu 12.04.1 LTS here.

Installing latest git-core + git-subtree

First add the PPA, update & upgrade.  Then install git packages that are held back by apt.  Also install asciidoc (optional if you want the manpage).

sudo add-apt-repository ppa:git-core/ppa && sudo apt-get update && sudo apt-get -y upgrade && sudo apt-get -y install git git-man git-svn asciidoc

Next, install the source package & make git-subtree + manpage:

[ ! -e '~/src/git-core' ] && mkdir -p ~/src/git-core
cd ~/src/git-core && apt-get source git-core
cd ~/src/git-core/git-*/contrib/subtree/
[ -e '/usr/lib/git-core' ] && sed -i -e '/^libexecdir.*/ s|/libexec/|/lib/|' Makefile || echo '/usr/lib/git-core does not exist! Check that your libexec dir exists and reinstall git-subtree'
sudo make prefix=/usr && sudo make prefix=/usr install && sudo make prefix=/usr install-doc

This may not work for you if you’re not using Ubuntu (your prefix or libexec dir may be different).  If in doubt, get git-core from upstream and build it from there, or install the script to $(git --exec-path)/git-subtree and chmod 755 it (see Makefile & INSTALL doc in contrib/subtree).

Now you should be able to use the ‘git subtree‘ command.  For help, run ‘git help subtree‘ or ‘man git-subtree‘.

Some helpful examples of git subtree in use in the wild:



Update 2012-10-22:  Currently the package for git 1.8.0 from the PPA does not include the script.  If you are using the __git_ps1 function in your bash prompt, you’ll need to get the source package and find that file in /home/jcuzella/src/git-core/git-1.8.0/contrib/completion/ Install that file somewhere under your home directory and then add a line to your .bashrc file to source it. You’ll know if you need it because you’ll probably see this message after installing latest git:

__git_ps1: command not found
[ ! -e '~/src/git-core' ] && mkdir -p ~/src/git-core && cd ~/src/git-core && apt-get source git-core
[ ! -e '~/src/bin' ] && mkdir ~/bin
cp ~/src/git-core/git-*/contrib/completion/ ~/bin/
chmod +x ~/bin/
echo '. $HOME/bin/' >> ~/.bashrc

New Improved Development Environment!

I finally got my home development server completely updated, including a freshly compiled Gentoo hardened kernel!  Now that I’ve got my server setup and working smoothly again, I started looking into the IDE side of the equation so I could do PHP web development on my laptop.

So after looking around a bit, I stumbled upon the idea of using Eclipse to do PHP development.  In the past I have disliked Eclipse due to it’s tendency to have problems with it’s workspace “.metadata” files over time, along with it’s slowdowns and/or freezing.  However, after seeing a presentation about Mylyn I reconsidered.  After looking up some other plugins, I was convinced that Eclipse is definitely worthy of a second look.  What’s Mylyn you ask?  In a nutshell: Mylyn is a task oriented plugin to Eclipse, giving you the benefit of saving what files & tabs you have open in Eclipse for a specific task.  A task can be anything, a bug report in Bugzilla that you’re working on, or simply a powerpoint presentation (An example given in the presentation with Tasktop Pro, the fully featured task oriented desktop app from Tasktop Technologies).

Why am I reconsidering Eclipse?  Well for starters:

  1. It’s built on Java, so I won’t be tied to using Windows for my laptop forever (Eventually I’m looking into getting a Mac)
  2. Mylyn allows integration with Bugzilla, along with a solution to my constant “too many tasks with too many tabs” problem.
  3. It includes built-in task scheduling features, perfect to start training myself to do better time management.
  4. Allows for developers to share “contexts” for each task (or bug) with one another, allowing for easy views on what parts of the code a bug/feature affects.  Collaboration is made that much easier!
  5. The PHP Development Tools (PDT) project gives PHP code completion, PHP debugging (once you install an apache server library), and all the other nice standard features of Eclipse.  For the Apache module, you’ve got the choice of either the free & open source XDebug or the binary blob Zend Debugger.
  6. The Subclipse plugin allows for nice integration with SVN (although I prefer git, I am forced to use for a couple projects).  I was also familiar with using this plugin in my college’s Software Development class, where we used Eclipse & SVN to do Agile Java programming with many different teams over the course.
  7. The Ajax Tools Framework (ATF) gives many of the features that the FireBug plugin for Firefox supports including: DOM Inspector, JavaScript Debugging, live CSS style editor, and all that good stuff.  It does this by embedding Mozilla into Eclipse!

I’m really excited to start debugging PHP code on the server.  Previously I’d been using jEdit, an SSH terminal, and Firefox to develop.  This upgrade should improve my productivity a lot.

Sanity at last!

In case anyone’s been wondering why my blog hasn’t been updated for a while… there are a bunch of reasons.  A 1 sentence reason would be: my environment went insane!  It all started with the lack of organization in the past couple months, which began with me graduating from college (w00t!).  After this, I ended up with a lot more time than I’m used to having, along with the lack of ability to use it properly.  All of this, along with big changes in my life led to a big disorganized mess building up over time concerning my site, development environment, and life in general.

Here’s a quick summary:

  1. Started looking for a job, put off development for a couple weeks while I celebrated graduating, tried to figure out my living situation, and dealt with my first job offer fizzling due to interviewing for a position that wasn’t sure to exist.
  2. Moved in with my girlfriend, and moved my development webserver with me (a Gentoo hardened machine named Polaris).
  3. The tweeters on my studio monitor speakers blew out during a frequency sweep in the 19-20kHz range!  Note to self: CHECK LEVELS FIRST IN THE AUDIBLE RANGE! Especially before trying to reproduce frequencies on the border of the inaudible range!
  4. Finally ran an ‘emerge -avuDN system’ and ‘emerge -avuDN world’ on Polaris.  Had to resolve a couple blocks that arose & rebuild a bunch of stuff multiple times (ran ‘etc-update’ and ‘revdep-rebuild’ ad nauseum).
  5. Fixed database backup scripts that kept emailing me once a day about how they were failing.
  6. After server was updated, tried updating WordPress via the method I previously posted about & ran into a big issue with SVN.  I ended up having to rebuild from a fresh SVN checkout of the latest WordPress release, and re-checkout my installed plugins & other changes on top of that.
  7. After rebuild, so far site seems stable & development server is also mostly sane & stable.  Success at last!

This whole process happened over the course of months, alongside taking care of stuff with life in general.  My monitor speakers are currently in the process of making their way back to me after getting new replacement tweeters.  As such, I’m still waiting to be able to release and/or redo the mixes for the new LyraPhase episodes that were aired on after October 12th, 2009 (Episodes 004 -> 011 !!).

NOTE: I’m no longer in college, so the live radio show is now over with.  However, I am planning on doing a podcast online.  This will start with the remaining original LyraPhase episodes, and will continue from there.

I’ve currently got a recording of 004 almost ready to go, but I’m really thinking about re-recording it now, along with some of the others.  The reasons for this are: I had 1 poor track that didn’t flow well in 004, and I’m confident I can now mix much better, and have learned a couple new tricks.

To my few fans that have been waiting patiently: don’t worry, the episodes ARE coming as soon as I get my speakers back.  I’d estimate that 004 should be out sometime in the next 2 weeks (depending on the time it takes them to ship the speakers back to me).

WordPress Updated to latest: 2.8.5

Thanks to the local dev server setup I have, along with svn and git, I’ve successfully and painlessly updated to wordpress 2.8.5.  Pushing changes to the wordpress_base branch on my site is quite simple, as I don’t really plan on modifying the core wordpress code that much.  Any changes to the code made by an svn update will only change files that I probably haven’t ever touched, so merging branches should be painless.  Plus, the core wordpress code is tracked by svn, while both the core code and my changes are tracked by git.  That way, I’ve got my own local branches that incorporate any updates made by svn, plus everything else.

In case you’re really interested and wondering how this is all done, see the following links:

Basically all you have to do is follow the wordpress update instructions from the 2nd link, but replace the svn switch command with the one found at the 1st link.  The way to update in git is pretty smart, since all core wordpress code changes are tracked in the main wordpress_base branch, then updated via svn, put the changes into a new integration branch, then rebase the master branch onto that one & checkout the merged changes to the master branch.

Originally it seemed stupid to use svn to track the remote wordpress repo, however I tried using git’s svn capabilities and found that the only supported way to switch svn tags within git broke everything, so it’s actually better and more painless to use both CVS systems.

Site finally online!

So I’ve finally managed to figure out the intricacies of tracking wordpress via SVN, while locally using git to track my entire site, plus any other changes made to wordpress locally.  So everything should be working at least until the next wordpress upgrade, at which point I’ll hope my current upgrade process still works.

I should have some mixes from the show uploaded soon.  I’m also hoping to switch to the carrington theme, but for now at least it’s working.


-DJ Phasic (^_^)

Get Adobe Flash player