Posts

Showing posts from September, 2011

Set default merge options for Git branches

Image
Time for a little Git tip!

Suppose you are the integrator of a branch. It is your responsibility to merge different branches from your co-workers. You want to keep a linear history. I.e. you want to avoid this:


Simply configure your master branch like this:
git config branch.master.mergeoptions "--ff-only" Now every time you want to merge a branch that does not create a linear history, you will get the following (rather direct) message:
fatal. Not possible to fast-forward, aborting. Now you can rebase that branch and merge it again (or tell your co-worker to do that for you, the lazy git).

You can configure multiple options:
git config branch.master.mergeoptions "--ff-only –-squash" This configures the branch so that it only accepts a linear history and squashes all commits into a single new commit.

Want to remove these merge options? Simply do:
git config --unset branch.master.mergeoptions Remember that these options are local for your Git repository. You have to r…

Custom MSBuild tasks to clone Git repositories and more…

Image
Every good work of software starts by scratching a developer's personal itch.
Eric Raymond – The Cathedral and the Bazaar I love Git. I like the way it completely changed my way of thinking about version control. It has completely replaced Subversion for my personal projects.
I also love MSBuild. It is in my opinion an underappreciated, flexible, extensible and relatively unknown technology that can handle all your build problems. It is my first choice as a build tool for all continuous integration projects.
MSBuild is effectively an untyped Lisp-2 with ugly XML syntax
snprbob86 on Reddit
MSBuild does have community tasks that integrate with different version control systems, but Git is not one of them. (The Git love is spreading slowly in the Windows community…)
What else to do but write my own custom MSBuild tasks that integrate with Git? So, I present MSBuildGitTasks

A typical use case for  MSBuildGitTasks in my MSBuild projects:
Clone a Git repository onto the build computer. Sw…