0

I have a remote branch named as qa(old_ui). I don't have it locally. I used the command

git push origin --delete qa(old_ui)

but no luck. I think that is because of the brackets.

The error is "The term 'old_ui' is not recognized as the name of a cmdlet, function, script file, or operable program.

by the way, I want to use pure git commands to accomplish this.

Joachim Sauer
  • 302,674
  • 57
  • 556
  • 614
Hello
  • 796
  • 8
  • 30
  • The error message suggests you are doing this in PowerShell. It's almost always a good idea to quote names like that, did you try `--delete "qa(old_ui)"`? – Joachim Sauer Feb 20 '23 at 14:39
  • I used the powershell but no working. The error is `fatal: not a git respository...` – Hello Feb 20 '23 at 14:43
  • @Hello You seem to be in the wrong directory when you execute this command. You must be in the local clone of the remote repository so you can execute the command. – knittl Feb 20 '23 at 14:46
  • @knittl, I am not sure. I check out the branch to the local and run the command. Same error – Hello Feb 20 '23 at 14:56
  • @Hello `cd` into the cloned directory before calling push: `git clone git.server.fqdn/path/to/HelloRepo.git; cd HelloRepo; git push origin --delete 'qa(old_ui)'` – Mathias R. Jessen Feb 20 '23 at 14:57
  • It seems single quote works.@MathiasR.Jessen – Hello Feb 20 '23 at 15:12

1 Answers1

2

Thanks for the comments from everybody. It seems like the single quotes works in the correct directory.

git push origin --delete 'qa(old_ui)'

Hello
  • 796
  • 8
  • 30
  • Powershell is finicky about special characters. Another one that comes up from time to time in Git is that `@` is shorthand for `HEAD`, but in [powershell it must be escaped](https://stackoverflow.com/a/61490618/184546). – TTT Feb 20 '23 at 17:16