Stackoverflow launched

September 16, 2008 in en, howto, software engineering

If someone actually read my previous posts (heh), (s)he may have noticed that I quite often link to www.codinghorror.com. It is Jeff Atwood’s blog, and I usually find it very exciting to read. His style of writing and ability to convey complex messages in a simple way is my holy grail. And if he is not able to do it himself, he links to other authors A LOT. Instead of repeating same thing that has been said over and over again he just links to proper post made by some other fellow programmer/software engineer. Avoiding duplicity is really one of basic goals of programming. Instead of repeating same code 20 times, just write a function and call it 20 times.

But that is just low-level stuff. Jeff, Joel Spolsky and few others, embarked on an adventure to get rid of duplicity in minds of programmers. Programming is so inherently complex that no one really knows solution to every problem. And don’t get me started on optimal solutions. What did you do when you found solution to some programming challenge, or some tricky workaround for problem that was bugging you for weeks? If you have a blog, you could go and post your solution there. Maybe someone would notice. Maybe not. So what did Jeff & Co. do? They created and launched ww.stackowerflow.com. Quoting from about page:

Stack Overflow is a programming Q & A site that’s free.

As is often the case, powerful ideas come in simple packages :-). It is that simple. You ask, others answer. Then you vote and best answer wins. It’s kind of expertexchange.com, just without the paying part, and with better user participation. Users who have proven themselves to be worthy can earn karma points and thus become more-less moderators. Try it out, and you will see what I mean. Begin with reading their FAQ.

How to change author of git commit?

August 19, 2008 in en, howto, software engineering


I recently needed to rewrite history of commits in a private
Git repository, because I wanted to change my email address in every commit. Note that you should not try following tip in a repository that anyone has pulled from. Normally Git doesn’t allow you to do this kind of thing, since changing authorship is…well bad (usually also against the law).

Let’s assume that email address changed from dev@comp1.com to dev@comp2.com. To create copy of repository $PROJECT_DIR to new repository $NEW_REPO with changed emails we can do following:

$ cd $PROJECT_DIR # change to project repository

$ git fast-export --all > /tmp/project.git # export repository to temporary file

$ sed 's/^author\(.*\)/author\1/' /tmp/project.git # replace emails on every line starting with 'author'

$ cd $NEW_REPO # change to empty directory

$ git init # initialize git

$ git fast-import

Third step is potentially dangerous, because you have to make sure that you don’t edit contents of any file aside from metadata. If you change content of files, git fast-import will complain because sha1 hash will not be correct.

Be sure to read git fast-import and git fast-export man pages for additional information. It took me a while playing with git-rebase and similar stuff to realize that they do not offer such feature, so if this tip helps anyone else I’ll be glad.