Delete a remote branch

1 view
Skip to first unread message

Charles Roper

unread,
Mar 6, 2008, 4:44:27 AM3/6/08
to Ruby on Rails: TextMate
OK, this has me completely stumped. I want to delete a remote branch
on github. How do I do this? I just can't find a definitive answer
online.

Here's the precise nature of what I want to do:

Cygwin made some file mode changes due to a default config option and
I pushed these up to my rails2_ebundle branch. I now want to revert
these changes and restore the original file modes. I thought the
easiest way of doing this would be to dump the rails2_ebundle and
start it again but it seems that all paths are paved with mind-bending
complexity and I can't work out how to revert or delete the remote
branch. Git really is great, but it sure ain't intuitive. :)

Nic Williams

unread,
Mar 6, 2008, 4:46:51 AM3/6/08
to rubyonrail...@googlegroups.com
Say you have a branch foo on your remote repo 'origin':

 
git push origin :foo

 
The colon before the name forces the delete. Weird yes.

http://drnicwilliams.com - Ruby/Rails/Javascript/Web2.0
(skype) nicwilliams
(p) +61 412 002 126 / +61 7 3113 3033
(mail) PO Box 583 Ashgrove 4060 QLD Aus

Lawrence Pit

unread,
Mar 6, 2008, 5:58:27 AM3/6/08
to rubyonrail...@googlegroups.com

this might not be an issue for you now, but if you had already done quite a lot of work you may not want to delete your remote branch and loose all it's history.

so instead, what I would do, first do git log, suppose the output is something like:

commit 06a11faaba83082ea0d99fad1dd86c139f9a43d1
Author: Me <m...@foo.com>
Date:   Thu Mar 6 21:52:05 2008 +1100

   new fixes

commit 0e1f3cb02557e7871a7bb7b7965143ad2ff19b6a
Author: Me <m...@foo.com>
Date:   Thu Mar 6 21:50:15 2008 +1100

    did this and that.

commit 153577becc39d28c3e3a7d54b558aca766e4a59a
Author: Me <m...@foo.com>
Date:   Thu Mar 6 20:01:24 2008 +1100

    some description....



... and you want to undo the last change. Then I would do:

git revert 06a11fa
git push origin master



Lawrence

Charles Roper

unread,
Mar 6, 2008, 8:18:22 AM3/6/08
to Ruby on Rails: TextMate
Awesome, thanks so much guys. For some reason, finding simple, concise
information like this via Google just isn't working for me.

What would you say is the best beginners resource?
> > On 3/6/08, *Charles Roper* <charles.ro...@gmail.com
> > <mailto:charles.ro...@gmail.com>> wrote:
>
> > OK, this has me completely stumped. I want to delete a remote branch
> > on github. How do I do this? I just can't find a definitive answer
> > online.
>
> > Here's the precise nature of what I want to do:
>
> > Cygwin made some file mode changes due to a default config option and
> > I pushed these up to my rails2_ebundle branch. I now want to revert
> > these changes and restore the original file modes. I thought the
> > easiest way of doing this would be to dump the rails2_ebundle and
> > start it again but it seems that all paths are paved with mind-bending
> > complexity and I can't work out how to revert or delete the remote
> > branch. Git really is great, but it sure ain't intuitive. :)
> > http://drnicwilliams.com- Ruby/Rails/Javascript/Web2.0

Simon Jefford

unread,
Mar 6, 2008, 11:01:00 AM3/6/08
to rubyonrail...@googlegroups.com
I like http://www.kernel.org/pub/software/scm/git/docs/user-manual.html.
If it doesn't give you what you need directly, chances are it points
to a man page that does.

Charles Roper

unread,
Mar 6, 2008, 12:43:40 PM3/6/08
to Ruby on Rails: TextMate
Great. I had come across that in various google searches but I'd never
seen the contents page like that. Looks like just the ticket. Thanks
Simon.

On Mar 6, 4:01 pm, "Simon Jefford" <simon.jeff...@gmail.com> wrote:
> I likehttp://www.kernel.org/pub/software/scm/git/docs/user-manual.html.
> If it doesn't give you what you need directly, chances are it points
> to a man page that does.
>

Nimai Etheridge

unread,
Mar 6, 2008, 8:11:41 PM3/6/08
to rubyonrail...@googlegroups.com
I found the git peepcode really useful as well.  it came with a handy pdf cheatsheet.  well worth the price of admission

Charles Roper

unread,
Mar 7, 2008, 8:51:01 AM3/7/08
to Ruby on Rails: TextMate
> git push origin :foo

OK, so I'm just trying to understand exactly why this works. The colon
is something to do with the refspec, right? So does that command mean:
push null/nothing to the foo branch of the origin, thus deleting it?

Charles

On Mar 6, 9:46 am, "Nic Williams" <drnicwilli...@gmail.com> wrote:
> Say you have a branch foo on your remote repo 'origin':
>
> git push origin :foo
>
> The colon before the name forces the delete. Weird yes.
>
> On 3/6/08, Charles Roper <charles.ro...@gmail.com> wrote:
>
>
>
>
>
> > OK, this has me completely stumped. I want to delete a remote branch
> > on github. How do I do this? I just can't find a definitive answer
> > online.
>
> > Here's the precise nature of what I want to do:
>
> > Cygwin made some file mode changes due to a default config option and
> > I pushed these up to my rails2_ebundle branch. I now want to revert
> > these changes and restore the original file modes. I thought the
> > easiest way of doing this would be to dump the rails2_ebundle and
> > start it again but it seems that all paths are paved with mind-bending
> > complexity and I can't work out how to revert or delete the remote
> > branch. Git really is great, but it sure ain't intuitive. :)
>
> --
> Dr Nic Williamshttp://drnicacademy.com- Ruby/Rails training/dev around the worldhttp://drnicwilliams.com- Ruby/Rails/Javascript/Web2.0
Reply all
Reply to author
Forward
0 new messages