ale
ale

Reputation: 11830

There is a remote git branch but no match local branch, how to delete the remote one

The following command:

$ git branch -a

yields

* develop
  master
  remotes/origin/HEAD -> origin/develop
  remotes/origin/develop
  remotes/origin/feature/foo
  remotes/origin/master

but I don't want remotes/origin/feature/foo branch. What could I have done to have this? How do I delete it?

I've tried this:

git push origin --delete origin/feature/foo

but I get this:

error: unable to push to unqualified destination: origin/feature/foo
The destination refspec neither matches an existing ref on the remote nor
begins with refs/, and we are unable to guess a prefix based on the source ref.
error: failed to push some refs to '...my remote repo...'

Any ideas? Many thanks :).

Upvotes: 0

Views: 353

Answers (1)

KingCrunch
KingCrunch

Reputation: 132031

When you call

git push origin feature/foo

git really sees

git push origin feature/foo:feature/foo

what means "push feature/foo (left side) to remotes feature/foo (right side).

With

git push origin :feature/foo

you push "nothing" to feature/foo

Upvotes: 3

Related Questions