Syntax highlighting in nano

MacOS

Install Homebrew if not already installed. Then install nano via homebrew

brew install nano

Open nanorc file

nano ~/.nanorc

Add the following line

include "/usr/local/share/nano/*.nanorc"

Refresh your terminal and voila, nano syntax highlighting

Linux

Open nanorc file

nano ~/.nanorc

Add the following line

include /usr/share/nano/sh.nanorc

Refresh your terminal and voila, nano syntax highlighting

Refs:
GithubGist
Stack Overflow

Delete commits from a branch in Git

It happens sometimes… no judging here

Careful: git reset --hard WILL DELETE YOUR WORKING DIRECTORY CHANGES. Be sure to stash any local changes you want to keep before running this command.

Get rid of current commit (HEAD~1 means the commit before head)

git reset --hard HEAD~1

Or look at git log output to find the id of the commit you want to back up to, and then

git reset --hard <sha1-commit-id>

If you already pushed it, you will need to do a force push to get rid of it

git push origin HEAD --force

Refs:
Stack Overflow