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

How to Get Windows 7′s Aero Snap Feature in Linux

So I’ve just finished creating my own script based off of the tips found at LifeHacker, OMG Ubuntu, ClickOnF5, and a video here.

You may ask: why create yet another script for this?  Well, I found a couple issues with the other implementations that bugged me.

  1. After snapping, windows lost their original dimensions :-/
  2. The left & right states failed to unset the horizontal maximized window property :-(
  3. Inputting the scripts directly into CCSM, or separate scripts was a bit messy

So, I created a single script that fixes these issues, and also adds another feature: Set a window’s size back to a default state.  Currently, this default is set using a bash variable, because I usually like to keep my terminals and nautilus windows one manageable size.  I also mainly find myself only using this snap feature on nautilus and terminal windows as well, so it works for me.  Perhaps in the future there may be some need to keep track of each window’s individual default size… but that’s too complicated for now.

How to use:

Use -l for left, -r for right, -m for maximized, and -d for a “default” sized window. The default window geometry is configurable as a variable called $WIN_DEFAULTGEOM.  If the variable is set at runtime, it will override the hardcoded value in the script.  You can use this to create however many default window sizes you need if you set them in multiple commands in compiz.  See the manpage for wmctrl for the format to specify window geometry arguments. (This is called <MVARG> in the manpage).  If you’re wondering why I chose such a weird default value… it cooresponds to an 80×26 line terminal window on my resolution.


aero-resize -l  # Snap left
aero-resize -r  # Snap right
aero-resize -m  # Maximize
aero-resize -d  # Default size (as hardcoded in script)
# You may also use whatever geometry you wish like so:
WIN_DEFAULTGEOM=0,20,80,800,600 aero-resize -d

How to install:

Get the script and save as “aero-resize” someplace in your PATH (I put mine in ~/bin). Then add the commands you wish to your compiz command config, or simply use it in a terminal window to resize it.

cd ~/bin
chmod +x aero-resize

Here are some screenshots of my compiz settings. If, you’re still having trouble, follow the instructions in this video, but replace the commands he uses with my script.

Compiz config manager commands for aero snap script

Compiz config manager commands for aero snap script

Compiz config manager key bindings for aero snap

Compiz config manager key bindings for aero snap

My Yubikeys Three, OpenID, and Productivity

My three yubikeys

My Yubithree

I just received a couple of brand new version 2 yubikeys!  Previously, I had been one of the first round of people to purchase the version 1 yubikey.  Originally back when I had first received my version 1 key, I had high hopes of playing around with it as a home project.  However, things in real life managed to pull me away from getting very far with it.  I had planned to help with the yubico-pam module for linux, or perhaps mess around in PHP or Ruby to implement my own authentication server.  This reminded me about my current struggle with Getting Things Done (GTD).  Along the way, I’ve learned a couple of productivity tips that I’d like to share.

With college coming to a close, I ended up having too much to handle between my Security & Privacy, Java/Datastructures, and Senior Design courses.  (That’s not to mention the internet radio show and DJ-ing.)  However, I did learn a thing or two about SSL, Java programming, and RFID last year.  Knowledge is always good!

Being Productive with Projects

Lately, I’ve been really wanting to pick up some of my old abandoned projects so I can try to break my old habits of procrastination that I learned too well in college.  There are mainly three things that I’ve been battling with to do this:

Time Management

The first thing I started learning was to try and figure out how to schedule the various things that I need to get done each day.  It’s a lot harder than it sounds. The first bad habit I had to break here was the nocturnal sleep schedule that college had ingrained in me.  Getting a job helped with that, because it started forcing me to get up early.  I’ve always been somewhat of an insomniac anyway, and have learned that if I don’t get enough sleep one night, then the next I’ll definitely be really tired and want to get to bed early.  The first few weeks were painful, but I think most of it is out of my system.

Learn to break the inertia

The next obstacle to combat procrastination is to create a small goal for yourself and then just start working towards it.  I’ve found that the longer I work with a specific goal in mind, the easier it is to keep going.  This works even after stopping for the day.  Once you start your wheels turning, it’s definitely easier to motivate yourself.

Don’t get distracted

Here’s the one I’m currently fighting.  I’ve always been able to multitask, but there’s a point where this gets really distracting.  I’ve found that my first problem here is surfing the web to research one thing, and then the next thing I know I’m looking up why cats lick themselves so much.  I’m not sure if it’s ADD/ADHD related.  The other problem with getting distracted has to do with subtasks.  I usually start task A, and then realize that I need to get subtask B done first.  This can go on forever until I forget which task I started out on, or which order I needed to get them done in.  (Perhaps a stack could help here).

To combat this, luckily I’ve found a couple tools that can help.


The first is a plugin for Eclipse called Mylyn.  I first talked about it in my post titled “New Improved Development Environment“.  It’s made managing tasks in programming much easier.  The main idea here is that for any given programming “task”, you’ve got a set of files that are related to it.  For example, your task could be “fix CSS bugs”, so you would have a bunch of CSS files open that you’re editing.  Mylyn takes care of this problem by keeping track of which open file tabs are associated with what task.  It calls this a “context”.  The other thing Mylyn does is integrate with various bug trackers, so you’ll see all your current bugs as tasks in Eclipse.  There’s also a professional version of Mylyn called “Tasktop” that takes this idea of task-oriented tab management to other applications, including Firefox!  Sadly, you’ve gotta pay for it, and it’s kinda pricey ($99).

The next tool I found was inspired by my desire to have something like Tasktop.

Managing Tabs in Firefox

We’ve all probably had the problem of too many tabs in Firefox.  Even if the tab overload doesn’t bring the browser to a crawl, it sure does slow down my productivity!  That’s where the TabMix Plus plugin comes in handy.

TabMix is a session manager plugin for Firefox.  Firefox has it’s own built-in session manager, but it’s mainly limited to one session which it restores on the occasion of a crash.  TabMix lets you manage multiple sessions, which can be composed of window(s) that contain multiple tabs.  Before I had this plugin, I would generally have a bunch of subtasks (or even completely different tasks) going at once, all in a single Firefox window!  Now, I organize my FF windows by separate subtasks, and save each session with some description of the main task that I was doing.  It’s a bit more overhead to manage and organize tabs, but it definitely keeps me much more focused and clear headed.  The other nice thing is that I can set new tabs to open and load Google.  Now a web search is only a Ctrl+t away!

(Tip: Google desktop also has a nice shortcut Ctrl+Ctrl that will let you type in a query and search either your desktop or the web fast too)

It’s also got nice features like: make new tabs to open next to the current one, window and session histories, control what the mouse buttons do on each tab, and a bunch of other great configuration options that I won’t mention here.  Sadly the organizational features of TabMix are a bit lacking when compared to Tasktop, but overall it’s definitely a good thing to have.

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).

Get Adobe Flash player