Playing with TeamCity on Azure

Update: This post is now available at a new location:
https://blog.ngeor.com/2018/03/10/playing-with-teamcity-on-azure.html

I spent the past two days playing with setting up TeamCity on Azure. This is just a poc more than anything else, but it’s always fun to do something new. I had to fiddle about with some things that didn’t work as expected, so here are some notes to remember what I did.

Continue reading Playing with TeamCity on Azure

Advertisements

Removing git submodules

Update: This post is now available at a new location:
https://blog.ngeor.com/2017/09/30/removing-git-submodules.html

Submodules is an advanced git feature. It allows you to have a folder inside your repository which serves as a link to a different repository. Working with submodules is more complicated and I haven’t had a real need for it so far. Last week I had to deal with a codebase which was doing heavy usage of submodules, but without a good reason, so I got rid of them.

Continue reading Removing git submodules

On git branching models

Update: This post is now available at a new location:
https://blog.ngeor.com/2017/09/23/on-git-branching-models.html

Usually, when you work with a version control system like git, development happens in multiple branches. It’s funny to see people’s faces when you tell them that the author of Continuous Delivery, Dave Farley, advocates “no branches”. I had that same surprised face myself the first time I heard that concept. But, so far, I haven’t really worked somewhere where no branches were used.

Continue reading On git branching models

Extracting code metrics from git

Update: This post is now available at a new location:
https://blog.ngeor.com/2017/02/22/extracting-code-metrics-from-git.html

TL;DR: I wrote a bash script that walks through your git repository history and calculates number of commits, number of merged pull requests, number of files and total number of lines of code, broken down per month.

Continue reading Extracting code metrics from git

git tip: Delete merged branches

Update: This post is now available at a new location:
https://blog.ngeor.com/2016/01/26/git-tip-delete-merged-branches.html

If you want to delete your local branches that have already been merged to master remotely, run this in a bash shell:

$ git branch -D `git branch --merged | grep -v '*' | xargs`

This deletes all branches that are merged, except the currently checked out branch (that’s the part with the start). So you should better run this while you’ve got the master branch checked out.

Update 2018-08-25: Powershell equivalent:


PS> git branch --merged | ? { $_ -notmatch '\*' } | ForEach-Object { git branch -d $_.Trim() }

A different way for bash:


$ git branch --merged | grep -v '*' | xargs git branch -d

Note that if you squash & merge (a popular option in GitHub and Bitbucket), then git branch --merged will not return these branches. In that case, try git branch -l but with the extra risk you might delete a branch you were still working on.