cd to directory after running sudo

This fixes the problem of running `git COMMAND` without being in the right directory. The problem appears when running `sudo`, hence losing the context of the directory you're in. This pull request fixes this behaviour.