How to commit files modified by pre-commit hook in Git

Solution 1:

You can do something like this:

#!/bin/sh
#

perl -i -pe 's/var app_version = "\d+\.\d+\.\K(\d+)/ $1+1 /e' ./version.js

git add ./version.js

What it does: It changes the string var app_version = "0.1.1"; to var app_version = "0.1.2"; and adds the file back to the git commit process. When you commit the latest change will be included.