pre-commit under Windows

First, lets mention Git Bash (aka msysgit) : the old version was a PITA to extend with additional packages (e.g. adding common C libs like libxml), and the new one (renamed Git for Windows), is based on MSYS2, but does not include a package manager.

Hence, we were left with 2 alternatives, both very good :

  • Cygwin (my personal favourite) and its great & simple package manager apt-cyg. Make sure you use a recent enough Cygwin, with $BASH_VERSION at least 4.2 (because of this bug). Then, there is how to install apt-cyg and the pre-commit command :
lynx -source rawgit.com/transcode-open/apt-cyg/v1/apt-cyg > apt-cyg
sudo install apt-cyg /usr/local/bin && rm apt-cyg
apt-cyg install wget

apt-cyg install git python gcc-g++ libxml2-devel libxslt-devel
curl --silent --show-error https://bootstrap.pypa.io/get-pip.py | python
pip install pre-commit
  • MSYS2 and its built-in package manager pacman :
pacman -S git python gcc libxml2-devel libxslt-devel
curl --silent --show-error https://bootstrap.pypa.io/get-pip.py | python
pip install pre-commit

EDIT [2016/02/11]: sadly, Stephen Jungels transcode-open/apt-cyg has been subject to an DMCA complaint. Incidentally, Github user @svnpenn created a fork named sage, but legal issues remain as can be observed in this DMCA counter-claim & the sage project issues.