cleanup and refactor git scripts