Re: [git-users] permanent branch deletion on origin

2012-11-26 Thread Konstantin Khomoutov
On Mon, 26 Nov 2012 07:06:35 -0800 (PST)
Jeffrey Marans  wrote:

> I've done a cvs2git conversion of a number of cvs modules and was
> unable to exclude the private working branches, PWB*.
> I'd like to delete them from the git repos and have tried the
> following, but the branches live on regardless of the output messages.
> By that I mean if I clone another instance of test, the branches
> still show up on the origin server.
> 
> mkdir test
> cd test
> git clone git@git:/git/gitroot/oacis/test
> cd test
> git branch -r | grep PWB
[...]
>   origin/PWB9
> 
> for i in `git branch -r | grep PWB`;do git branch -rD $i;done
[...]
> Deleted remote branch origin/PWB9 (was a8ab921).

You misunderstand what those "origin/foo" branches are.
Unfortunately, the naming of these things adopted by Git just adds to
the confusion (though I don't think they could do it any better).

Those branches *in your local repository* (which are not shown by a call
to `git branch` without the "-r" command-line option) are the
so-called "remote branches".  They capture the state of the branches
the corresponding remote repository had the last time you did
`git fetch` from that repo.  They exist only in your repo, as a
reference, and deleting them (or renaming or whatnot) does not affect
any remote repository in any way.  They are like bookmarks.  They
exists to provide convenient handles to "remote" history, but in the
same way as removing a bookmark from a book does not affect a book,
removing a remote branch from your local repository does not even hits
the network and modifies only your local repository.  The next
`git fetch origin` will (re-)create these branches.

To delete something from a remote repo you have to use a somewhat
obscure (on the first sight) feature of the `git push` command -- you
should push *nothing* to a named remote object (a branch in your case).

The idea goes like this: the full syntax to update a branch named
"master" in the remote repo with the contents of your local branch
named "master" is spelled as
$ git push origin master:master
Git allows you to drop the remote object specification -- the ":master"
part -- in which case it's assumed the remote object will have the same
name and type, so when you do
$ git push origin master
Git takes your local object "master" (be it a branch or a tag -- it
does not matter) and tries to update a same-named object in the remote
repo, creating it if necessary.

If you want to delete an object from a remote repo, you push nothing to
it -- using the full syntax:
$ git push origin :master
means updating an object named "master" in the remote repo with
nothing, thus deleting it.

So to delete a branch named "PWB9" from "origin" you should do
$ git push origin :PWB9

You could also employ the fact Git is able to use wildcards for both
local and remote objects, so you could possibly do
$ git push origin ':refs/heads/PWB*'
where you tell it to remote all heads (branches) matching the "PWB*"
pattern.  Be sure to protect the pattern from the shell, if needed.


As usually, this syntax is explained in the `git push` manual page.
And in The Book [1] as well.

1. http://git-scm.com/book/en/Git-Branching-Remote-Branches

-- 




Re: [git-users] permanent branch deletion on origin

2012-11-26 Thread jmarans

Pretty close, big thanks.
This is what worked

git   push   git@git:/git/gitroot/oacis/builder   :PWB1
To git@git:/git/gitroot/oacis/builder
 - [deleted] PWB1



On 26/11/12 10:34 AM, William Mizuta wrote:
I think that git branch -rD only deletes the local reference to remote 
branches.


If you want to delete the branch in your remote repository, for 
example PWB1, type git push origin :PWB1



William Seiti Mizuta
@williammizuta
Desenvolvedor da Caelum



--




Re: [git-users] permanent branch deletion on origin

2012-11-26 Thread Joe Cabezas
you can use

git push  :

that push in  your local branch  into the remote
branch 

if you want to delete a branch in , you can do this:

git push  :< branch_remote >

it's like to say: "please, copy nothing from my local to ",
and voila, deleted

Bye!

-Joe


2012/11/26 William Mizuta 

> I think that git branch -rD only deletes the local reference to remote
> branches.
>
> If you want to delete the branch in your remote repository, for example
> PWB1, type git push origin :PWB1
>
>
> William Seiti Mizuta
> @williammizuta
> Desenvolvedor da Caelum
>
>
>
> On Mon, Nov 26, 2012 at 1:06 PM, Jeffrey Marans  wrote:
>
>> I've done a cvs2git conversion of a number of cvs modules and was unable
>> to exclude the private working branches, PWB*.
>> I'd like to delete them from the git repos and have tried the following,
>> but the branches live on regardless of the output messages.
>> By that I mean if I clone another instance of test, the branches still
>> show up on the origin server.
>>
>> mkdir test
>> cd test
>> git clone git@git:/git/gitroot/oacis/test
>> cd test
>> git branch -r | grep PWB
>>   origin/PWB1
>>   origin/PWB10
>>   origin/PWB2
>>   origin/PWB3
>>   origin/PWB4
>>   origin/PWB5
>>   origin/PWB6
>>   origin/PWB7
>>   origin/PWB8
>>   origin/PWB9
>>
>> for i in `git branch -r | grep PWB`;do git branch -rD $i;done
>> Deleted remote branch origin/PWB1 (was 4e34650).
>> Deleted remote branch origin/PWB10 (was 2992912).
>> Deleted remote branch origin/PWB2 (was b9126e8).
>> Deleted remote branch origin/PWB3 (was e48d2d1).
>> Deleted remote branch origin/PWB4 (was 32c90f3).
>> Deleted remote branch origin/PWB5 (was 234f826).
>> Deleted remote branch origin/PWB6 (was 72409ca).
>> Deleted remote branch origin/PWB7 (was 234f826).
>> Deleted remote branch origin/PWB8 (was e30b526).
>> Deleted remote branch origin/PWB9 (was a8ab921).
>>
>>  --
>>
>>
>>
>
>  --
>
>
>

-- 




Re: [git-users] permanent branch deletion on origin

2012-11-26 Thread William Mizuta
I think that git branch -rD only deletes the local reference to remote
branches.

If you want to delete the branch in your remote repository, for example
PWB1, type git push origin :PWB1


William Seiti Mizuta
@williammizuta
Desenvolvedor da Caelum



On Mon, Nov 26, 2012 at 1:06 PM, Jeffrey Marans  wrote:

> I've done a cvs2git conversion of a number of cvs modules and was unable
> to exclude the private working branches, PWB*.
> I'd like to delete them from the git repos and have tried the following,
> but the branches live on regardless of the output messages.
> By that I mean if I clone another instance of test, the branches still
> show up on the origin server.
>
> mkdir test
> cd test
> git clone git@git:/git/gitroot/oacis/test
> cd test
> git branch -r | grep PWB
>   origin/PWB1
>   origin/PWB10
>   origin/PWB2
>   origin/PWB3
>   origin/PWB4
>   origin/PWB5
>   origin/PWB6
>   origin/PWB7
>   origin/PWB8
>   origin/PWB9
>
> for i in `git branch -r | grep PWB`;do git branch -rD $i;done
> Deleted remote branch origin/PWB1 (was 4e34650).
> Deleted remote branch origin/PWB10 (was 2992912).
> Deleted remote branch origin/PWB2 (was b9126e8).
> Deleted remote branch origin/PWB3 (was e48d2d1).
> Deleted remote branch origin/PWB4 (was 32c90f3).
> Deleted remote branch origin/PWB5 (was 234f826).
> Deleted remote branch origin/PWB6 (was 72409ca).
> Deleted remote branch origin/PWB7 (was 234f826).
> Deleted remote branch origin/PWB8 (was e30b526).
> Deleted remote branch origin/PWB9 (was a8ab921).
>
>  --
>
>
>

--