bhartsb
bhartsb

Reputation: 1366

I have two remote branches with similar names. Will this command delete the right one?

I have two remote branches:

I want to delete origin/origin/dev.

Will the following command do what I want?

git push origin --delete origin/dev

Upvotes: 0

Views: 28

Answers (1)

jub0bs
jub0bs

Reputation: 66284

You would do well to pick better branch names; you would avoid a few headaches like this one :)

As I understand it, you have two branches living in the remote repo called origin:

  • dev
  • origin/dev

A quick test in a toy repo indicates that, under the assumption that origin/HEAD doesn't point to the remote branch called origin/dev, the command

git push origin --delete origin/dev

will indeed do what you want. To be clear, this command will

  • delete the branch called origin/dev that lives in the origin remote repo, and which is associated with your (local) remote-tracking branch origin/origin/dev.
  • leave intact the branch called dev that lives in the origin remote repo, and which is associated with your (local) remote-tracking branch origin/dev.

Upvotes: 1

Related Questions