My Git hint : a feature per commit

Have you had a look on your project git log ? It is often an enumeration of changes which are sometimes not explained correctly… « bugfixes », « some changes », « work in progress », « pull request review ».

wip git log

The log what you would want to see is a log of all features recently added from the JIRA (or any other issue tracker) board.
Moreover, having your features grouped in one commit will be a way to know all of the necessary changes for each issue (because a git diff will reveal all the changes of a feature at once)

Here is how it can be done :

– As a setup, create this command alias in your .gitconfig file (I assume that your main branch is called « master » here.)

singleCommit = "!f() { git pull origin master --no-edit && git push && git reset --soft origin/master && git commit -m \"$1\" && git push -f; }; f"

– create a git branch from « master »
– commit everything you want inside this branch, don’t hesitate to commit or push any correction for a mistake you found.
– create a pull request if you need to, review the comments, commit / push, and so on.
– when everything is ready and the code is ready to be merged, find the JIRA code (or your issue tracker issue id) (we will name it MYPROJECT-XXXX)
– issue this command : git singleCommit "MYPROJECT-XXXX a comment for this feature" (change this text to the aim, or the title of the feature)
– if the command fails, your branch is not synced with master. Resolve the conflicts, git add . and git commit, then go back to the instruction before.
– now you can merge. There will be ONE commit for all the content of the branch.

Replayable REST logs on spring-mvc

« What happens on this app ? I cannot figure out what these logs mean… »
That is one of the typical sentences we are likely to say when it comes to debugging in blackbox mode (without access to the code itself).

Although, there is one thing we all know : In a situation, the app creates some pieces of data and then send them to another object (whether it is a person or a service).

In some recent web architectures, with spring, we are likely to send REST requests to other services. We can customize how the data is sent and also how we should trace it.

The idea I want to underline is that a kind of logs that help is a « replayable log », which means that someone looking at the code can try a request once more to understand a failing scenario, step by step, accurately

Then, why not curl logs ? A curl log syntax is really short, understandable and concise. It helps to understand how the data is being sent to another actor.

How to start ?
1. You can copy this gist into your app :
2. Add it inside your RestTemplate in your App Spring Configuration :

public RestTemplate thirdPartyServiceRestTemplate () {
final RestTemplate restTemplate = new RestTemplate();
restTemplate.setInterceptors(java.util.Collections.singletonList(new org.toilelibre.libe.logs.CurlLogHttpRequestInterceptor()));

return restTemplate ;