Support custom gitDir

Get new gitDir constructor arguments
Use gitDir or the default '.git' directory
Save Flags which can be useful later