Exporting GIT history to a CSV/Excel file

There are many tools to compute stats from your GIT repositories, but sometimes, you may just want to export it to Excel and make your own quick and direty stats.

the git log command, with pretty print, is your friend. For example, the following command will display the commit date, hash, commiter name and email, and the commit message :

git log --pretty=format:%cI,%h,%an,%ae,%s > commits.csv

The pretty format documentation is available here : https://www.git-scm.com/docs/git-log#_pretty_formats

Mockito : how to mock method return value based on argument ?

When using mockito to mock some methods behaviour, you may want to change your mocked method return value based on an argument value.

This is not obvious, but quite simple to achieve, thanks to this SO post :

     .thenAnswer(invocation -> invocation.getArgument(0, String.class));

Making enum values available to Angular template

Let’s say you want to make some enum values available to your Angular template. Angular binding cannot reference directly the enum value. A hack to work this around consists in adding to your component class a member variable initialized with the enum type.

Ex :

import { Component, Input, OnInit } from '@angular/core';

enum TransfertNature {Gerant, Etablissement, Autre};

  selector: 'app-transfert-siege',
  templateUrl: './transfert-siege.component.html',
  styleUrls: ['./transfert-siege.component.css']
export class TransfertSiegeComponent implements OnInit {

  nature: TransfertNature;

  TransfertNature: any = TransfertNature; // Can be used in the template

  constructor() { }

  ngOnInit(): void {


The Angular template will then be able to referece any value using the variable. Ex :

  <ng-container [ngSwitch]="transfert.nature">
    <ng-container *ngSwitchCase="TransfertNature.Gerant">

Spring Data and JpaRepository method naming convention

Spring Data can infer SQL queries from JpaRepository method name. That’s a great tool to uniformize query generations, and make code more readable. Obviously, this only works for simple SQL queries, wchich is indeed what you should strive for.

The documentation about the JpaRepository method naming convention is available here :


Key points :

  • “Order by” is represented by the keyword “OrderBy”, followed by the name of the entity member variable. Keyword “Asc” and “Desc” indicates the sort direction. You can sort by multiple columns by specifying each colum and its sort direction.
    Ex : findByDossierOrderByDateAscIdAsc(Dossier dossier)