git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: remotely deleting a branch

From
John Tapsell <johnflux@gmail.com>
Date
Jun 1, 2009, 11:02 UTC
Message-ID
<43d8ce650906010402t792df314v1ed632e79f42bca7@mail.gmail.com>
In-Reply-To
<1de9d39c0906010316v657f2624i3f16b8b5bea73122@mail.gmail.com>
2009/6/1 jean-luc malet <jeanluc.malet@gmail.com>:
Show 16 quoted lines
> hi!
> I created a remote branch by doing
> $ git push origin mynewbranch
> I done some work on mynewbranch, commited, pushed changes to origin,
> merged it to master and pushed to origin and deleted the mynewbranch
> localy because I don't need it anymore
> now I want to "undo" the git push origin mynewbranch ie remotely
> delete the branch from the repository
> I tried git push --mirror but it deleted all remote branches that I
> didn't worked on... I don't want to have it be a mirror... but
> something like
> $ git branch -r -d origin/mynewbranch
> $ git push
>   ---> deleting origin/mynewbranch
>
> how shall I do that?

Yeah, it's pretty confusing on how to delete a remote branch. The magic command is:

git push origin -f :mynewbranch

Hopefully someone will figure out a way to make git a bit more intuitive in this respect. Maybe a remote option for git branch -d or something. John

Previous: jean-luc maletNext: Gustaf Hendeby
Message 2 of 3 in “remotely deleting a branch”
  1. jean-luc maletJun 1, 2009
  2. John TapsellJun 1, 2009
  3. Gustaf HendebyJun 1, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.