Skip to content

Running git rm fails with 'unknown switch' #791

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nmagerko opened this issue Aug 27, 2018 · 1 comment
Closed

Running git rm fails with 'unknown switch' #791

nmagerko opened this issue Aug 27, 2018 · 1 comment

Comments

@nmagerko
Copy link

I am trying to check out an orphan branch in a repository that has previous commits in it. For example, commits A, B, and C are in master, but I want to make a branch separate that has no commits, and no staged changes.

In order to do that, given that repo is a Repo instance initialized properly, I am running:

repo.git.checkout(orphan="separate")
repo.git.rm("-r -f .")

The result I'm getting is:

git.exc.GitCommandError: Cmd('git') failed due to: exit code(129)
  cmdline: git rm -r -f .
  stderr: 'error: unknown switch ` '
usage: git rm [<options>] [--] <file>...

When I run the command in cmdline from the command line, everything seems to work out correctly. However, I'm not sure why it looks like git is trying to pick up another switch here. Is there something I'm not seeing?

@nmagerko
Copy link
Author

Whoops, looks like it should be repo.git.rm("-r", "-f", "."). Sorry about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant