Travis-CI fix for error reference not a tree

In these scenarios:

  • git commit --amend
  • squash and force push over previous commits

Travis-CI may give an error like:

fatal: reference is not a tree: The command “git checkout -qf ” failed and exited with 128 during .

Workaround

Travis-CI uses a default Git clone depth of 50. While their docs suggest changing the depth to 3, this can be too shallow for common Git use cases. We would suggest either not specifying the Git clone depth (using the default) or specifying a depth larger than the number of commits your team would ever squash and force push (overwriting prior commits). For example in .travis.yml:

git:
  depth: 25
  quiet: true