I want to create a new branch using GitPython. I usually use the following git command for the same:
Git command:
git checkout -b feature/test-git-python
Code:
from git import Repo
PATH_TO_REPO = XXXX
repo = Repo(PATH_TO_REPO)
repo.git.stash()
repo.git.checkout('master')
repo.git.checkout('-b feature/test-git-python')
Error:
git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
cmdline: git checkout -b feature/test-git-python
stderr: 'fatal: ' feature/test-git-python' is not a valid branch name.'
This is the error I am getting. I assume it's taking the space before the branch name into consideration.