Git commands

Revert last commit in local repository

$ git revert HEAD --no-edit


Delete commit from history

$ git reset --hard <hash>


Delete tag

$ git tag -d <tag>

Modify an already existing commit

$ git add <file>
$ git commit --amend -m "modify commit"

Pull changes from a remote repository

$ git fetch

Create bare repos

$ git clone --bare hello hello.git

Submit changes to the remote repository

$ git push shared master

Restart web server Nginx + PHP-FPM Mac OS

Restart NGINX

$ sudo launchctl unload /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
$ sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.nginx.plist


$ cp /usr/local/Cellar/php55/5.5.31/homebrew.mxcl.php55.plist ~/Library/LaunchAgents/

Restart PHP-FPM

$ launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.php55.plist
$ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php55.plist


Optimize jpg with Jpegtran

Install Jpegtran:

$ apt-get install libjpeg-progs

Convert one file to Progressive JPEG and optimize with Jpegtran:

$ jpegtran -progressive -optimize -outfile image.jpg image.jpg

Convert all files to Progressive JPEG and optimize with Jpegtran:

$ find /the/image/path -name "*.jpg" -type f -exec jpegtran -copy none -optimize -outfile {} {} \;