improve Makefile.git

Change the example Makefile.git as suggested in #895
  abort when a patch fails to apply
  fix build with GNU Make 4.0
  reset git to the specified version instead of checking out a detached head