-
Notifications
You must be signed in to change notification settings - Fork 8k
Description
Describe the bug
I wanted to quick merge a PR I had a link to and didn't bother changing directories, so I ran the merge from my home directory. I am not sure what would have happened if I was in different repository at the time, but needless to say my home directory is not a git repository. I hoped I would still be able to merge and to my delight I could, but I got an error trying to delete the local branch and as a result the remote branch was not deleted.
~ $ gh --version
gh version 1.5.0 (2021-01-21)
https://github.com/cli/cli/releases/tag/v1.5.0
Steps to reproduce the behavior
- Type this
gh pr merge <pull request url>, from home directory (not a git repo) - Choose to delete remote and local (despite only really wanting to delete remote)
- See error
could not determine current branch: fatal: not a git repository (or any of the parent directories): .git /usr/bin/git: exit status 128
Expected vs actual behavior
The remote branch was not deleted, presumably because it tries to remove the local one first and fails.
I would expect it to delete the remote anyway. If that is undesirable for reasons I hadn't considered it would be nice to have a remote-only delete or to have only been prompted for a remote delete since I was not in a repo.
Logs
~ $ gh pr merge https://github.com/joe-sharp/old-arduino-projects/pull/3
? What merge method would you like to use? Create a merge commit
? Delete the branch locally and on GitHub? Yes
? Submit? Yes
✔ Merged pull request #3 (Update README.md)
could not determine current branch: fatal: not a git repository (or any of the parent directories): .git
/usr/bin/git: exit status 128