M-x Kelsin

A Hacking Blog

Rewriting Commit History

Recently at work I was working on a small bug fix git branch that had MANY small commits doing relatively the same thing. I really wanted to go through and clean up the commit messages to make them uniform and actually needed to change some of the commits too.

By google searching I found this stack overflow question that gave me my answer. This user wrote about how using rebase –interactive can be used to specify any number of commits to edit. You basically call git rebase --interactive COMMIT where COMMIT can be HEAD^ to just do one commit, or any SHA1 or branch reference as normal. Git will open your $EDITOR with a file listens all commits in question. You can then edit this temporary file to tell git what commits to let you edit and which ones to drop completely or merge into the commit above them (which you can do manually via edit as well). Then git will play through your commits that you’ve said you want to edit one at a time, and drop you into a shell to let you do anything you want. Sometimes you want to edit just the commit message so you just git commit --amend and change the message. Other times you want to undo the last two commits and redo them git reset HEAD^^ and then edit and commit again.

Also just to remember this (recently discussed at work as well):

<ul>
  • git reset HEAD^ undoes the last commit and places changes as changes in the working tree.
  • <li><code>git reset --hard HEAD^</code> removes the commit changes completely (not form the git data store, but completely from your working tree at least)</li>
    
    
    
    <li><code>git reset --soft HEAD^</code> puts the changes into a "staged" state. This makes it east to add to a commit while you have many other edited files in your tree (Maybe even more changes to a changed file that you don't want to add into this commit)</li></ul>
    

    Demon's Souls Mini-Review

    I’ve only played the first level of Demon’s Souls so far but it’s very fun.

    I started a Knight Templar and Caitlin started a Thief. Both play very differently and start with different gear / weapons. It’s very clear that the many pre-reviews of this game that talked about the weapon system being fun were pretty accurate.

    So far the graphics have been great, the game play is great. The game IS HARD. You die a lot on your way to figuring out how to beat obstacles. I had to give in to some of my OCD and just realize that this was part of the game. The game is made with the idea that you WILL lose all of your souls multiple times while trying to play a level. In a sense the game can be thought of as a Japanese shooter in disguise. You practice and practice at the levels until your skill at the game improves and is able to play it flawlessly. It’s awesome!

    Instant PhpBB3 Speed Improvements

    Recently at work we’ve installed a php accelerator onto one of our php apps. We were having load problems on the box (Moodle installs) and the accelerator helped solve the problem. This got me thinking and I decided to install an accelerator on my Linode in order to speed up my World of Warcraft guild forums (a phpbb3 install)

    After doing some reading I decided to try out Xcache. I don’t have ANY opinions on which accelerator is better (this isn’t the one we chose at work for Moodle). I chose this one for the SOLE reason that Debian Lenny had it in the repository. Installing it was DEAD simple:

    
    sudo aptitude install php5-xcache
    
    sudo /etc/init.d/apache2 restart

    Can’t get any simpler. Now my phpbb forum pages load INSTANTLY. It’s absolutely amazing and awesome.

    This is making me want to move this blog over to the Linode very fast!

    Git Ignoring already committed (tracked) files

    In my current local development environment for work I don’t have access to our authentication mechanism. Our rails site uses a cookie from our main site. In order to ignore this I commonly edit my controllers with a line like:

    
    self.current_user = User.find(5)
    
    

    (This is just a snippet and doesn’t include the code that allows for the current_user method, this post is NOT about authentication in rails). This allows me to just work on features without having to do some complicated cookie copying and other stuff I’d rather not mess with.

    I use magit on emacs to do my git management and I hate seeing that this controller has a change in it (same with using “git-status”). I don’t want to accidentally commit this change either. The simple answer to this is to tell git to mark this file as “not changed”. I found this post that told me about this feature. This feature exists in order to help people with slow filesystems but it works great for this use as well:

    
    git update-index --assume-unchanged path/to/file

    Now the files don’t show up in any status commands or when I commit with “git commit -a”. These files will cause git to gracefully error when merging in a branch that changes these files (so you can manually handle it) and it will remove this flag if you manually “git add” these individual files.

    The problem I ran into is that I want an easy way to check what files are setup like this. I couldn’t find a git command to do this already so I added these aliases:

    
    [alias]
    
        marked-unchanged = !git ls-files -v | grep ^[a-z]
    
        mu = !git ls-files -v | grep ^[a-z]
    
    

    Now both “git marked-unchanged” and “git mu” show me a list of files that are set this way so I don’t forget. I want to add magit commands to show this and set this as well but that will be another day and another post.

    Blue Man Group and then Midatlantic!

    So I finally got around to seeing Blue Man Group and I really enjoyed it. I did feel that some sections especially in the beginning were a tad slow. I would have liked to have seen more comedy or music in exchange for some of the drawn out segments. I did enjoy the show a lot however. It was a lot more on the “artsy” side than I originally though it would be. I enjoyed that aspect of it a lot. I felt it had a very nice my-first-artsy-theater-show ring to it.

    After the Blue Man Show we ate some dinner at Pizza Pie-er before heading over to the Paradise Rock Club to see some co-workers perform in their band Midatlantic. I have seen them twice before (Once at Great Scott’s and once opening for Letter’s to Cleo at the Paradise as well) but this was my first time seeing them with a new drummer and new keyboard player (both co-workers of mine).

    Their set was pretty tight. I do have to admit that I really like “Fly Me Home” off their first album (when they were stilled called “The Bleedin Bleedins”) and was disappointed to not hear it. It’s one of those songs where even after the show two nights ago, I left humming Fly Me Home instead of one of the songs performed. But enough about me loving pop hooks, their show was really good.

    They have an interesting sound that relies on a lot of electronics. I think one of the reasons I enjoyed them is that guitarist Barry Kelly (fair warning: also a co-worker) doesn’t play guitar like most other bands I go see. His parts provide nice counter melodies and licks that work well with the vocal lines instead of providing a rhythmic base. They rely on their electronic parts (as well as bass) for that. Seeing them with a keyboard player was great cause it humanized that part of the show. While it has always been a great part of their sound, it can continue into a great part of their live show as well. It verged on the line of “backing track” before and now that feeling is gone (at least for me).

    The new drummer is great and the band doesn’t sound like they’ve skipped a beat with any of these new changes. I liked all three new songs they performed so definitely excited to hear more material and see what ends up on a new album. Having seen the drummer (Rob Fusco) and keyboardist (John Mileham) in their previous bands I know what each can do and I’m excited to see what some of their influences bring to Midatlantic. I definitely wish I could see them over in Ireland later this year!