Skip to main content

Posts

Showing posts from 2012

The Foolproof Git Setup

There was a recent complaint on Git User mailing list. Quote:
Why do I have to be a source control engineer just to be a software developer? Now, the main issue of this poor person is that his organization has failed to on-board him into his job. They told him to use Git, but didn't give him the means to do so productively (as far as we know, anyway).

What I started wondering was: Could his employer somehow have set up Git for him so that he could work with it just as easily as with Subversion?

Given a prepared .gitconfig with all the aliases and configurations that you wanted, could you really dumb down Git so much that it would be analogous to the simpleness of SVN?

Well, here's my take on it: To a certain degree: yes. If you could narrow down Git to do the most typical two SVN commands:
update (pull without merging), andcommit (with push) .. that would help a lot.
Dumbing down pull The first step would be to make git pull as stupid as an svn update - always rebase local com…

My résumé in git log

I was helping a friend shape up his CV/résumé recently. Along the way I thought it would be cool to maybe have a bit more original format than the traditional paper, so I tried it out on mine just for fun:


$ git log career

commit 6f554814186594113ce2060aed3e4240b7fb852e
Author: Thomas Ferris Nicolaisen <[email protected]***.com>
Date:   Mon Jul 01 11:01:59 2011 +0200

    Software developer at Viaboxx Systems

commit 1478c77d52fe41ba855fa2181527a7deea480e58
Author: Thomas Ferris Nicolaisen <[email protected]***.com>
Date:   Tue Jan 3 10:03:18 2009 +0200

    Senior software developer at IP Labs GmbH/FujiFilm Group
    - Introduced a range of agile practices, like weekly iterations, 
      standup-meetings and continuous integration and deployment. 
    - Lead the first Scrum project, integrating services with FujiFilm 
      partners across the Atlantic and in Asia.

commit 23265936762d4ccaab8c8c0e4ff088650b4a63e2
Author: Thomas Ferris Nicolaisen <[email protected]***.com>
Date:   Tue Oct 16 10:02:44 2006 +0200

    C…

Sharing Git Tips on Coderwall

It's very easy to get side-trekked from blogging by doing stuff on other platforms, like Twitter, StackOverflow and forums. A more recent and inviting platform is coderwall for sharing #protips (I really hate that term, but, whatever). It looks nice and adds some discoverability for fellow enthusiast on whatever topic you're posting on (which in my case happens to be mostly Git).

Still, I don't want my regular blog readers to miss out on the premium octane knowledge I scatter around the web, so here's a couple of my recent tips I felt like cross-posting (also see the very valuable comments):

Shorter Git URLs - Showcasing how you can shorten SSH URLs using ~/.ssh/configCreate a random commit - For when you are playing with Git and just need a quick unique commitSee which Git command you use the most - By parsing through your shell history
On the last one, I pasted the output into LibreOffice Calc and got myself a nice graph:


All my coderwall tips are collected here: http…

Git for Insidrrrs

Today I did a quick Git intro for the fine folks at the second Insidrrr Day in Cologne.

I think it was the first time I ever did a presentation which wasn't purely aimed at programmers, as there were a lot of media/designer types in the crowd. Hopefully I managed to stay away from programming lingo enough for them to grasp what Git is about.

The presentation is available here.

Git Stash Blooper (Could not restore untracked files from stash)

The other day I accidentally did a git stash -a, which means it stashes *everything*, including ignored output files (target, build, classes, etc).



What I meant to do was git stash -u, meaning stash modifications plus untracked new files.

Anyhows, I ended up with a big fat stash I couldn't get back out. Each time I tried, I got something like this:

.../target/temp/dozer.jar already exists, no checkout
.../target/temp/core.jar already exists, no checkout
.../target/temp/joda-time.jar already exists, no checkout
.../target/foo.war already exists, no checkout
Could not restore untracked files from stash

No matter how I tried checking out different revisions (like the one where I actually made the stash), or using --force, I got the same error. Now these were one of those "keep cool for a second, there's a git way to fix this"situation. I figured:

A stash is basically a commit.

If we look at my recent commits using
git log --graph --all --decorate --oneline

...we see something …

Filtering out illegal characters using Guava

The other day, I needed to validate a text-field against a whitelist of characters. Actually, lots of text-fields needed lots of different sets of whitelists, but let's just stick to one for the sake of example.
The text field "First name" is only allowed to contain any of these characters:ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz°Žµ·žŒœŸÀÁÂÃÄÅÆ
ÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝ
Þßàáâãäåæçèéêëìíîï    
ðñòóôõöøùúûüýþÿ.. and the user should be notified with which illegal characters she has entered in the field, if any.
The knee-jerk reaction to this kind of logic is regular expressions, but my knee-jerk reaction to regexp is  to avoid it. The above character set probably doesn't fit with any of the predefined regexp notations, so it would probably be nasty anyway.


So, let's put Google Guava to some use. It has some nifty utilities for working with setsand other collections.

If you consider the user's input characters as one set, and the above whitelist characters …

Stop using GitX - use GitX (L) instead

I noticed the other day that the Git homepage presents the original GitX as a GUI alternative on OS X.

However, development on GitX ceased three years ago, and while there is an interesting fork from Brotherbard (development has ceased there as well), the most active continuation takes place in the fork GitX (L). The wiki of the orginal GitX confirms this.

A fellow called Erik Blomqvist has put up gitx.org which offers a more balanced view on the various forks. While there might be some value in the simplicity of the old GitX, three years is a long time in Git's development, and GitX is missing out on some newer Git features (like submodules).

Anyhow, there are still a number of pages out there that says GitX is still the way to go. People are even still submitting stuff in the bug-tracker, which is awfully pointless, of course.

Just keep this in mind next time someone asks you about a good Git GUI for Mac.

Flurfunk

A bit over a year ago, me and my colleague Felix started working on a little experimental project during our 20% time. As far as I can remember, we wanted to do some Clojure, and we wanted to make something that looked like a company-internal Twitter.



We called it Flurfunk, which is the German word for "office talk" or something along those lines.

After a few days of development, we set it up on an internal server, and it was already quite useful, as it was a nice way to group-chat with the whole team. We are co-located, so we don't really IM so much, but it's still nice for pasting URLs and unix one-liners, etc.

We then proceeded to integrate it with our Jenkins build notification mails, and commit mails, so there's a nice timeline of what's going on. A bit like our team's heartbeat.

A nice bonus is that if either of us are doing home-office, it's a nice way to interact with what the rest of the team is doing.

We actually open-sourced it back in Apri…

Gitblit: Stories from the Field

Continuing my little tribute to the Gitblit 1.0 release, I asked some old colleagues of mine, Leif and Trygve, about their experiences with using Gitblit in practice.

Q: How do you use Gitblit?  Leif:
Webstep is a consultancy company, and we needed a Git repository for a specific client project that is being run in-house.

At the moment the Gitblit server hosts three different projects, but only one is in active development.

Trygve:
I was working as a consultant in a team that was currently using Subversion, but wanted to switch to Git. IT were working on an installation of Gitorious, but the project didn't have a very high priority.

As an intermediate solution I looked around for small, simple solutions for hosting a low number of repositories (around 10). As it was only our team that was going to use it, we didn't have any need for complicated security setups, just plain hosting. Having a web interface was a big plus as I wanted to show it was easy to create lots of small proje…

Gitblit - The Little Git Repo Manager That Could

I've been tweeting about Gitblit every now and then, and also recommended it to people who want to run some Git infrastructure on Windows.

Seeing Gitblit v1.0.0 was released a few hours ago (Google+), I would like to celebrate and congratulate the project with a two blog-posts. This is the first, and the second I hope to do soon in shape of some interviews with a couple of Gitblit users.
Uh, what is a Git repository manager? It can be several things. Most people look for these features in a repo manager:

A central place to share repositoriesA web-frontend for said repositoriesManages users and access-control  Just to mention an alternative setup: At my dayjob, we use: A simple folder on a Linux server to put central repositories, accessible over SSHGitweb as a web-frontendAccess-control with SSH users and certificates We're quite happy with the above setup because we are a very Linux/Mac oriented shop, with a small team that have no fancy requirements on the access-control part.…

The Git Users Mailing List

A year ago or so, I came across the Git-user mailing list (aka. "Git for human beings").


Over the year, I grew a little addicted to helping people out with their Git problems. When the new git-scm.com webpage launched, and the link to the mailing list had disappeared, I was quick to ask them to add it again. I think this mailing list fills an important hole in the Git community between:

The Git developer mailing list [email protected] - which I find to be a bit too hard-core and scary for Git newbies. Besides, the Majordomo mailing list system is pretty archaic, and I personally can't stand browsing or searching in the Gmane archives.The IRC channel #git on Freenode, which is a bit out-of-reach for people who never experienced the glory days of IRC. Furthermore, when the channel is busy, it's a big pain to follow any discussion.StackOverflow questions tagged git, these come pretty close, but it's a bit hard to keep an overview of what questions people are askin…

The Anatomy of a Git Pull

Ever seen something like this?

➜  ~/projects/gitblit/[master]>git pull
remote: Counting objects: 5899, done.
remote: Compressing objects: 100% (1322/1322), done.
remote: Total 5746 (delta 4099), reused 5413 (delta 3770)
Receiving objects: 100% (5746/5746), 3.78 MiB | 853 KiB/s, done.
Resolving deltas: 100% (4099/4099), completed with 98 local objects.
From git://github.com/gitblit/gitblit
 * [new branch]      bootstrap  -> origin/bootstrap
 * [new branch]      gh-pages   -> origin/gh-pages
 * [new branch]      issues     -> origin/issues
 * [new branch]      ldap       -> origin/ldap
   8f73a7c..67d4f89  master     -> origin/master
 * [new branch]      rpc        -> origin/rpc
From git://github.com/gitblit/gitblit
 * [new tag]         v0.9.1     -> v0.9.1
 * [new tag]         v0.9.2     -> v0.9.2
 * [new tag]         v0.9.3     -> v0.9.3
Updating 8f73a7c..67d4f89
Fast-forward
 .classpath                                         |  137 +-
 .gitignore                            …

Broken Snapshots in Java Builds

Recently I've done a lot of thinking about build tools, especially in regards to Maven, Grails and Gradle, and how they play into release management and versioning with Git. This is just a post to get some of those thoughts off my chest. I'll come back to Gradle in future posts, as I build some more experience with it at work.

A few months ago, I wrote an article on our company blog about Grails' broken snapshot dependency mechanism.
Even though Grails (up onto, and including Grails 2) support snapshot dependencies, the feature is flawed in a way that makes it unusable for us. This will be fixed in Grails 3, but we couldn't wait that long, so we ended up hacking together a workaround. This article describes why and how we did it. (cont) Now I've done a lot of modularization of huge builds over the years, and I've come to really like Maven's snapshot dependencies as an enabler for balancing between externalizing a library, and keeping it as part of the build…

Github for Windows - first impressions

The other day I was listening to the recent Hanselminutes about Github for Windows (from now on abbreviated to GhfW), and decided to take it for a spin. I've had my pains explaining people how to set up Git on Windows, and I have pretty high hopes for this tool making it easier.

Dude, where's the frame..
At first I was a bit unsure if it was actually running, and not some popup on the current webpage:

This is the first Metro style application I've installed, I think. And it didn't take long to like the feel of the application, cause it feels light, smooth and fast. I heard that GhfW can be a real memory hog, but I can't really confirm that here. It starts off taking 50 megs, and then later grows to 120 with a few repos checked out. At the end of writing this blog post it's at 200 megs.

But I already have Git set up
Now, my Windows is already set up to use Git, so I was a bit surprised to see that after logging in, I have to configure my full name and email. And G…

My Git Setup on Windows

This is kind of a continuation of my earlier post about my terminal/shell on OS X and Linux.

As I was recently preparing for my Git on Windows talk, I naturally started tweaking the setup on Windows as well in the same direction, and I figured I'd share this setup.
Installing Git Either go with Git for Windows, or Git Extensions if you want more GUI as well as Visual Studio integration. I personally have grown a distaste for TortoiseGit, as it sometimes locks files in my repositories. But it's supposed to be good otherwise (as an alternative for Git Extensions).


During the Git install, you need to select the scary red option, for integrating Git into Windows cmd-line, if you want to use it from Powershell/Console2 (we'll get back to that later). The cygwin-like Git Bash is not sexy.
Update (30/4 2012): I think you could also wrap Console2 around Cygwin, although I haven't tried this myself yet. This way you can avoid the scary red option. There's also the altern…