Post Receive Hook to Update The Checked Out Copy

#!/bin/sh
cd ..
env -i git reset --hard

Add a remote

Note: There is no : between the host and the path

git remote add origin ssh://user@host/path/to/repo/.git

Undo the last commit

If you want the changes to stay in the working directory but just want to undo the actual commit.

git reset --soft HEAD^

If you want to get rid of the last change completely then to.

git reset --hard HEAD^

Display a pretty history of the git repository

git log --graph --all --pretty=format:'%Cred%h%Creset - %an %Cgreen%cr%Creset %s%C(yellow)%d%Creset' --abbrev-commit --date=relative

Cleanup

Show local branches that have been merged into the current branch

git branch --merged

Cleanup remote tracking branches that no longer exist upstream

git remote prune origin

Prune while fetching

git fetch --prune

References