Overwrite Author in Git History

With every commit, git records the name of the author as well as the committer along with their respective email addresses. These will be public once you push your project to GitHub. So sometimes it may be advisable to change the email addresses of the author and committer for all the past commits in your repository.

This can easily be verified by running git log.

Git keeping track of my email address …

Thankfully it is surprisingly easy to change the email addresses of author and committer in the repository. Simply run the following command in the toplevel of your working tree:

git filter-branch -f --env-filter "GIT_AUTHOR_EMAIL='newemail@site.com' GIT_COMMITTER_EMAIL='newemail@site.com';" HEAD

Finally just do a push.

git push --force

Note that adding --force is important here, since otherwise the changes will be rejected by the remote with the error message:

 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:repo/repo.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Do not do a git pull in that case since that will undo the updating of the author and committer.

If you only want to update the author or committer of some of the commits, you can also use git filter-branch. For instance as follows:

git filter-branch --commit-filter '
      if [ "$GIT_AUTHOR_EMAIL" = "to_update@mail" ];
              GIT_AUTHOR_NAME="New Name";
              git commit-tree "$@";
              git commit-tree "$@";
      fi' HEAD

Note that it is easy for things to go wrong here with providing the multi-line commit-filter – the easiest way is to put this command into a separate script file.

Mastering Modular JavaScript

Today I was having a look around for best practices for defining JavaScript modules. In that search, I came across the book Mastering Modular JavaScript. This book offers a good selection of best practices for JS module development. Also, all chapters are freely available on GitHub:

For a more basic introduction to modules, see the chapter JavaScript Modules from the book Practical Modern JavaScript.

Everything new in JavaScript since ES6

It is no secret that things in the tech world change rather rapidly. It’s difficult to keep track of everything at the same time. For instance I have been working with JavaScript quite extensively some years ago but recently have been more involved with other tech stacks. Thus I have only followed the developments in the JavaScript world sporadically and was quite surprised by how many things have changed since the days of JavaScript: The Good Parts.

Since before ES6 things have not changed much for a long time, I imagine I am not the only one who could benefit from a little refresher of all the things that have changed since ES6. Thus I have compiled some of the changes I think are most important for ordinary development work. The idea is to provide a quick overview rather than explain every feature in detail – assuming that more information on any of the changes is readily available on the web.

This is not a complete list of everything that has changed. For instance, I included promises but omitted changes made to the way regular expressions work in ECMAScript 2018; since we are likely to come across promises many times per day whereas the changes to regular expressions only affect us in particular edge cases.

ECMAScript 6 / ECMAScript 2015

Variable Scoping

  • let x = 1;: To define block scoped variables

Arrow Functions

  • x => x + 1: Concise closure syntax
  • x => { return x + 1; }: Concise closure syntax
  • this: within lambdas refers to enclosing object (rather than to lambda function itself)


Promises for wrapping asynchronous code.

let p = new Promise((resolve, reject) => {



p.then((msg) => console.log(msg)); 

Executing asynchronous operations in parallel

let parallelOperation = Promise.all([p1, p2]);
parallelOperation.then((data) => {let [res1, res2] = data; } );

Default Parameters and Spread Operator

  • function (x = 1, y = 2): Default values for function parameters
  • function (x, y, ...arr) {}: Capturing all remaining arguments in array for variadic functions
  • var newarr = [ 1, 2, ...oldarr]: ‘Spreading’ of elements from an array as literal elements
  • multiply(1, 2, ...arr): Spreading of elements from an array as individual function parameters

Multiline Strings and Templates

  • `My String⏎NewLine`: Multi-line string literals
  • `Hello ${person.name}`: Intuitive string interpolation
  • const proc = sh`kill -9 ${pid}`;: Tagged template literals for parsing custom languages. The example would result in calling the function sh with the parameters (['kill -9 '], pid)

Object Properties

  • let obj = { x, y }: Property shorthand for defining let object = { x: x, y: y }
  • obj = { func1 (x, y) { } }: Methods allowed as object properties

Deconstructor Assignment

  • var [ x, y, z ] = list: Deconstructing arrays into individual variables by assignment.
  • var [ x=0, y=0 ]: Default values for deconstructing arrays.
  • function( [ x, y ] ): Deconstructing arrays in function calls.
  • var { x, y, z } = getPoint(): Deconstructing objects into individual variables by assignment.
  • var { name: name, address: { street: street }, age: age} = getData(): Deconstructing objects into individual variables by assignment, including nested properties.
  • var p = { x=0, y=0 }: Default values for deconstructing objects.
  • function( { x, y } ): Deconstructing objects in function calls.


  • export function add(x,y) { return x + y; }: Exporting functions
  • export var universe = 42;: Exporting variables
  • import { add, universe } from 'lib/module';: Importing functions and variables
  • import * from 'lib/module': Wildcard import
  • export default (x, y) => x + y;: Defining default export
  • import add from 'lib/add': Importing default export
  • import add, { universe } from 'lib/add': Importing default export and additional exports
  • export * from 'lib/module';: Reexporting from other modules


class keyword for constructing simple classes.

class Point {

  constructor (x, y) {
     this.x = x;
     this.y = y;

  move (deltax, deltay) {
     new Point(this.x + deltax, this.y + deltay);


extends keyword for extending classes:

class Car extends Vehicle {

  constructor (name) {

static keyword for static methods

class Math {

  static add(x, y) {
    return x + y;


get and set keywords for decorated property access.

class Rectangle {

  get area() { return this.x * this.y }



new Rectangle(2, 2).area === 4;

Iteration Through Object Values

  • for (let value of arr) { }: for … of loop for going iterating through values of objects.
  • Also note that objects can define their own iterators and generators

Data Structures

  • new Set(): For sets
  • new Map(): For maps
  • new WeakSet(): For sets whose items will be garbage collected when required
  • new WeakMap(): For sets whose items will be garbage collected when required


  • Symbol(): For creating an object with a unique identity.
  • Symbol("note"): For creating a unique object with a descriptor.
  • Note: Symbol("node") !== Symbol("node")

ECMAScript 2016

  • **: Exponentiation operator
  • Array.prototypes.includes: Like indexOf but with true/false result and support for NaN

ECMAScript 2017

async/await for more expressive asynchronous operations

async function add1(x) {
  return x + 1;

async function add2(x) {
  let y = await add1(x);
  return await add1(y);


ECMAScript 2018

Rest/Spread Operators for Object Properties

Collect all not deconstructed properties from an object in another object:

var person = { firstName: "Paul", lastName: "Hendricks", password: "secret"};
var {password, ...sanitisedPerson } = person;
// sanitisedPerson = {firstName: "Paul", lastName: "Hendricks"}

Spread object properties

let details = { firstName: "Paul", lastName: "Hendricks" };

let user = { ...details, password: "secret" };

Finally for Promises

finally callback is guaranteed to be executed if promise succeeds or fails.

async function sayHello() {
sayHello().then(() => console.log("success") )
.catch((e) => console.log(e))
.finally(() => console.log("runs always")

for await Loop

Special for loops that resolve promises before every iteration.

const promises = [
  new Promise(resolve => resolve(1) ),
  new Promise(resolve => resolve(2) )

async function runAll() {
  for await (p of promises) {



Image credits: Flickr

Move git repository

Sometimes it is necessary to move the location of a git repository; be it from one GitHub repo to another or moving a repo from GitHub to Bitbucket. This can be surprisingly tricky since one needs to make sure to include all branches, tags, etc. when copying the data.

Thankfully git magic allows doing this fairly easily. Just run the following commands:

git clone --mirror <old-repo-url>
cd <repo-name>
git remote add new-origin <new-repo-url>
git push new-origin --mirror

That should be it!

Note that if you are copying a GitHub repo you might get lovely messages such as the following. That should be fine and nothing to worry about.

 ! [remote rejected] refs/pull/1/head -> refs/pull/1/head (deny updating a hidden ref)
 ! [remote rejected] refs/pull/10/head -> refs/pull/10/head (deny updating a hidden ref)
 ! [remote rejected] refs/pull/100/head -> refs/pull/100/head (deny updating a hidden ref)
 ! [remote rejected] refs/pull/101/head -> refs/pull/101/head (deny updating a hidden ref)
 ! [remote rejected] refs/pull/102/head -> refs/pull/102/head (deny updating a hidden ref)


Tech Tip: Make Spotlight Searches Faster on Mac OS X

One of the things I really like about Windows 10, is the ability to hit the Windows key and type the first few letters of the application name to find and open this application. Mac OS X in theory provides the same feature by hitting the Command Key + Space. This opens a spotlight search.

Unfortunately I found this search to be inferior to the one found in Windows since it works slower – even on my very powerful Mac machine, it often takes more than a two to three seconds to ‘find’ the application I try to open.

Last week, I found a way to somewhat mitigate this. Just head to the settings and in there to Spotlight. Disable all the categories apart from ‘applications’.


While this does make the search faster, also note that it won’t search for the other types of content anymore.

Upload Elastic Beanstalk Application using Maven

AWS Elastic Beanstalk is well established service of the AWS cloud and can be used as a powerful platform to deploy applications in various languages. In this short tutorial, I will outline how to conveniently deploy a Tomcat application to AWS Elastic Beanstalk using the beanstalk-maven-plugin.

The following assumes that you already have a project which is configured to be deployed as WAR and provides a valid web.xml to start answering requests. If you are unsure of how to set this up, please have a look at the example project web-api-example-v2 (on GitHub).

Step 1: Create IAM User

  • Create a new user on IAM user AWS for programmatic access


  • For Permissions, select ‘Attach existing policies directly’ and add the following policy


  • Save the access key and secret key

Step 2: Add Server to Local Maven Configuration

  • Add the following declaration in the element in your $HOME/.m2/settings.xml and provide the access key and secret key for the the user you’ve just created

  <username>[aws access key]</username>
  <password>[aws secret key]</password>

Step 3: Add Beanstalk Maven Plugin


  • Test your security credentials and connection to AWS

mvn beanstalk:check-availability -Dbeanstalk.cnamePrefix=test-war

Step 4: Create S3 Bucket for Application

  • Create a new S3 bucket with a name of your choice (e.g. the name of your application)


Step 5: Update Plugin Configuration

  • Provide the following configuration for the beanstalk-maven-plugin
    <applicationName>[Provide your application name]</applicationName>
    <!-- Path of the deployed application: cnamePrefix.us-east-1.elasticbeanstalk.com -->
    <solutionStack>64bit Amazon Linux 2015.03 v1.4.5 running Tomcat 8 Java 8</solutionStack>

    <!-- Bucket name here equal to artifactId - but this is not guaranteed      to be available, so therefore the bucket name is given statically -->
    <s3Bucket>[Provide your S3 bucket name]</s3Bucket>

Step 6: Deploy project

  • Run the following to upload the project to the S3 bucket:
mvn beanstalk:upload-source-bundle
  • If this succeeds, deploy the application

mvn beanstalk:upload-source-bundle beanstalk:create-application-version beanstalk:create-environment

Your application should now be deployed to Elastic Beanstalk. It will be available under


Where cname is the cname you have specified in step 5

Good To Know

  • To find out, which solution stacks are available (to define the solutionStack environment variable), simply run

mvn beanstalk:list-stacks


PlantUML (Open Source Awesomeness)

I’ve always had a soft spot for diagrams. I think that representing information in various visual ways tremendously helps our thinking and understanding. Unfortunately it is often a big headache to create (and maintain) diagrams.

So I was very pleased today when I came across PlantUML. PlantUML is a Java library and web service which renders UML diagrams from text input. Take the following text definition for example:

object Object01
object Object02
object Object03
object Object04
object Object05
object Object06
object Object07
object Object08

Object01 <|-- Object02
Object03 *-- Object04
Object05 o-- "4" Object06
Object07 .. Object08 : some labels

This will be rendered into the following diagram:


PlantUML does not just support object diagrams but also many other types of diagrams. There is another service, called WebSequenceDiagrams which focusses on only sequence diagrams (and is not open source) but can be useful if more visually pleasing sequence diagrams are required,

Git Versioning: Beyond Revisr

Some time ago, I have written an article about how to set up versioning for WordPress using git. I now came across an article by Newt Labs which have created an infographic about the justification for using git for WordPress. I think this infographic is quite insightful, so I will provide it below (with the kind permission of Newt Labs).

One thing which was of particular interest to me was that there was a handy list of alternatives to Revisr in the graphic. The alternatives are the following:

Personally I have only used Revisr, which worked fine for me. However, I am a bit concerned by their website greeting visitors with a warning about an expired SSL certificate. This should really have been fixed by now and is not building my trust in the tool.


Fix Travis CI Error ‘This is not an active repository’


Your repositories have been building just fine using the tool Travis CI but suddenly the builds do not work anymore and the Travis CI website shows a screen with the message:

`This is not an active repository`



  • Go to GitHub and assure that you are logged in with the account that owns the repository.
  • Go to Travis CI and sign in with your GitHub account
  • Go to the repository
  • Click on the button ‘Active Repository’

If all works, that’s fine. However, if you get an error: ‘There was an error while trying to activate the repository.’ do the following:

  • Go to the settings for your account on Travis – Assure that the repository you want to build is enabled.


Travis CI Issue #5629

StackOverflow `Seeing “This is not an active repository” for an active repository`

Cannot Install VirtualBox Guest Additions: Installer Hangs


For a CentOS based guest, the update of the VirtualBox Guest Additions hangs after the step: “Removing exiting VirtualBox non-DKMS kernel modules”



  • Check the log file in /var/log/VBoxGuestAdditions-uninstall.log. See if there is anything obvious reported there you can fix.
  • Check if your RAM disks are valid by running the command `sudo lsinitrd`.
    • If they are not, try rebuilding broken images with `sudo dracut -f [broken-image].img [kernel version]`
  • Verify you have all dependencies installed:
    • yum install dkms
    • yum groupinstall “Development Tools”
    • yum install kernel-devel
  • Reinstall your Kernel image
  • Verify that you have the correct version of kernel-devel installed
    • yum remove kernel-devel
    • yum install kernel-devel-`uname -r`
    • Restart system!
  • Wait!
    • Let the installation run for a while, at least 15-20 min. It might do something!