Refactor git functions to set `default-directory` instead of using `(cd && )`. Use split-string omit-nulls option instead of `replace-regexp-in-string`.