0ezo9q
Last Updated: February 25, 2016
·
538
· filosottile

Switch back and forth from a dev configuration with patch

Between your local dev code and the code you run on the remote (staging or production) server there's always some difference, if anything the database host etc.

My solution is to keep a patch, generated for example with git diff on a "dev state" working directory after a "production state" commit and then enter and exit the dev state with

patch -p1 < dev.patch

and

patch -p1 -R < dev.patch

Where -R means reverse, that is, it unapplies the patch.

P.S. you can even set is as a git hook.

Filed Under