* How do I delete a remote branch with a period in the name? @ 2012-07-03 3:09 jonsmirl 2012-07-03 4:14 ` Junio C Hamano 2012-07-03 7:56 ` How do I delete a remote branch with a period in the name? Andreas Schwab 0 siblings, 2 replies; 17+ messages in thread From: jonsmirl @ 2012-07-03 3:09 UTC (permalink / raw) To: Git Mailing List How do I delete a remote branch with a period in the name? jonsmirl@smirl2:/home/apps/florida/lpc31xx$ git push origin :fl To git@github.com:jonsmirl/lpc31xx.git - [deleted] fl jonsmirl@smirl2:/home/apps/florida/lpc31xx$ git push origin :fl.stg error: unable to push to unqualified destination: fl.stg 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 'git@github.com:jonsmirl/lpc31xx.git' jonsmirl@smirl2:/home/apps/florida/lpc31xx$ jonsmirl@smirl2:/home/apps/florida/lpc31xx$ git branch -r linus/master origin/HEAD -> origin/master origin/bar.stgit origin/dt-test origin/fl.stgit origin/foo.stgit origin/lpc313x-stg origin/lpc313x-stg.stgit origin/master origin/master.stgit origin/temp.stgit origin/v3.4-stg origin/v3.4-stg.stgit origin/v3.5-stg origin/v3.5-stg.stgit -- Jon Smirl jonsmirl@gmail.com ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: How do I delete a remote branch with a period in the name? 2012-07-03 3:09 How do I delete a remote branch with a period in the name? jonsmirl @ 2012-07-03 4:14 ` Junio C Hamano 2012-07-03 11:42 ` jonsmirl 2012-07-03 7:56 ` How do I delete a remote branch with a period in the name? Andreas Schwab 1 sibling, 1 reply; 17+ messages in thread From: Junio C Hamano @ 2012-07-03 4:14 UTC (permalink / raw) To: jonsmirl@gmail.com; +Cc: Git Mailing List "jonsmirl@gmail.com" <jonsmirl@gmail.com> writes: > jonsmirl@smirl2:/home/apps/florida/lpc31xx$ git push origin :fl.stg > error: unable to push to unqualified destination: fl.stg > 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. The message seems to be saying that fl.stg is not specific enough perhaps? What does "git ls-remote origin | grep fl.stg" say? If it says refs/smirl/fl.stg, for example, you can be specific as the message suggests, e.g. "git push origin :refs/smirl/fl.stg" or something like that? ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: How do I delete a remote branch with a period in the name? 2012-07-03 4:14 ` Junio C Hamano @ 2012-07-03 11:42 ` jonsmirl 2012-07-03 18:04 ` [PATCH] push: don't guess at qualifying remote refs on deletion Jeff King 0 siblings, 1 reply; 17+ messages in thread From: jonsmirl @ 2012-07-03 11:42 UTC (permalink / raw) To: Junio C Hamano; +Cc: Git Mailing List On Tue, Jul 3, 2012 at 12:14 AM, Junio C Hamano <gitster@pobox.com> wrote: > "jonsmirl@gmail.com" <jonsmirl@gmail.com> writes: > >> jonsmirl@smirl2:/home/apps/florida/lpc31xx$ git push origin :fl.stg >> error: unable to push to unqualified destination: fl.stg >> 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. > > The message seems to be saying that fl.stg is not specific enough > perhaps? What does "git ls-remote origin | grep fl.stg" say? If it > says refs/smirl/fl.stg, for example, you can be specific as the > message suggests, e.g. "git push origin :refs/smirl/fl.stg" or > something like that? I have the branch name wrong. It is fl.stgit not fl.stg. But the error message sent me off in the wrong direction looking for an answer. -- Jon Smirl jonsmirl@gmail.com ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH] push: don't guess at qualifying remote refs on deletion 2012-07-03 11:42 ` jonsmirl @ 2012-07-03 18:04 ` Jeff King 2012-07-03 18:34 ` jonsmirl 2012-07-03 19:38 ` Junio C Hamano 0 siblings, 2 replies; 17+ messages in thread From: Jeff King @ 2012-07-03 18:04 UTC (permalink / raw) To: jonsmirl@gmail.com; +Cc: Junio C Hamano, Git Mailing List When we try to push a ref and the right-hand side of the refspec does not find a match, we try to create it. If it is not fully qualified, we try to guess where it would go in the refs hierarchy based on the left-hand source side. If the source side is not a ref, then we give up and give a long explanatory message. For deletions, however, this doesn't make any sense. We would never want to create on the remote side, and if an unqualified ref can't be matched, it is simply an error. The current code handles this already because the left-hand side is empty, and therefore does not give us a hint as to where the right-hand side should go, and we properly error out. Unfortunately, the error message is the long "we tried to qualify this, but the source side didn't let us guess" message, which is quite confusing. Instead, we can just be more succinct and say "we can't delete this because we couldn't find it". So before: $ git push origin :bogus error: unable to push to unqualified destination: bogus 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 '$URL' and now: $ git push origin :bogus error: unable to delete 'bogus': remote ref does not exist error: failed to push some refs to '$URL' It is tempting to also catch a fully-qualified ref like "refs/heads/bogus" and generate the same error message. However, that currently does not error out at all, and instead gets sent to the remote side, which typically generates a warning: $ git push origin:refs/heads/bogus remote: warning: Deleting a non-existent ref. To $URL - [deleted] bogus While it would be nice to catch this error early, a client-side error would mean aborting the push entirely and changing push's exit code. For example, right now you can do: $ git push origin refs/heads/foo refs/heads/bar and end up in a state where "foo" and "bar" are deleted, whether both of them currently exist or not (and see an error only if we actually failed to contact the server). Generating an error would cause a regression for this use case. Signed-off-by: Jeff King <peff@peff.net> --- On Tue, Jul 03, 2012 at 07:42:07AM -0400, jonsmirl@gmail.com wrote: > I have the branch name wrong. It is fl.stgit not fl.stg. > But the error message sent me off in the wrong direction looking for an answer. I think this would help. I used "remote ref does not exist" because that is the simplest explanation for the user. However, given that we will try to push a fully qualified ref that does not exist, a more accurate message might "destination refspec did not match" or something similar. I prefer the former, though, as it less arcane. remote.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/remote.c b/remote.c index 6833538..04fd9ea 100644 --- a/remote.c +++ b/remote.c @@ -1100,6 +1100,9 @@ static int match_explicit(struct ref *src, struct ref *dst, case 0: if (!memcmp(dst_value, "refs/", 5)) matched_dst = make_linked_ref(dst_value, dst_tail); + else if (is_null_sha1(matched_src->new_sha1)) + error("unable to delete '%s': remote ref does not exist", + dst_value); else if ((dst_guess = guess_ref(dst_value, matched_src))) matched_dst = make_linked_ref(dst_guess, dst_tail); else -- 1.7.11.rc1.21.g3c8d91e ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH] push: don't guess at qualifying remote refs on deletion 2012-07-03 18:04 ` [PATCH] push: don't guess at qualifying remote refs on deletion Jeff King @ 2012-07-03 18:34 ` jonsmirl 2012-07-03 18:40 ` Jeff King 2012-07-03 19:38 ` Junio C Hamano 1 sibling, 1 reply; 17+ messages in thread From: jonsmirl @ 2012-07-03 18:34 UTC (permalink / raw) To: Jeff King; +Cc: Junio C Hamano, Git Mailing List On Tue, Jul 3, 2012 at 2:04 PM, Jeff King <peff@peff.net> wrote: > When we try to push a ref and the right-hand side of the > refspec does not find a match, we try to create it. If it is > not fully qualified, we try to guess where it would go in > the refs hierarchy based on the left-hand source side. If > the source side is not a ref, then we give up and give a > long explanatory message. > > For deletions, however, this doesn't make any sense. We > would never want to create on the remote side, and if an > unqualified ref can't be matched, it is simply an error. The > current code handles this already because the left-hand side > is empty, and therefore does not give us a hint as to where > the right-hand side should go, and we properly error out. > Unfortunately, the error message is the long "we tried to > qualify this, but the source side didn't let us guess" > message, which is quite confusing. > > Instead, we can just be more succinct and say "we can't > delete this because we couldn't find it". So before: > > $ git push origin :bogus > error: unable to push to unqualified destination: bogus > 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 '$URL' > > and now: > > $ git push origin :bogus > error: unable to delete 'bogus': remote ref does not exist > error: failed to push some refs to '$URL' This error return would have made my mistake obvious. Might want to add a paragraph to the doc saying this is how you delete remote branches since it is not an obvious solution. I found it via Google and a question asked on stackoverflow.com > It is tempting to also catch a fully-qualified ref like > "refs/heads/bogus" and generate the same error message. > However, that currently does not error out at all, and > instead gets sent to the remote side, which typically > generates a warning: > > $ git push origin:refs/heads/bogus > remote: warning: Deleting a non-existent ref. > To $URL > - [deleted] bogus > > While it would be nice to catch this error early, a > client-side error would mean aborting the push entirely and > changing push's exit code. For example, right now you can > do: > > $ git push origin refs/heads/foo refs/heads/bar > > and end up in a state where "foo" and "bar" are deleted, > whether both of them currently exist or not (and see an > error only if we actually failed to contact the server). > Generating an error would cause a regression for this use > case. > > Signed-off-by: Jeff King <peff@peff.net> > --- > On Tue, Jul 03, 2012 at 07:42:07AM -0400, jonsmirl@gmail.com wrote: > >> I have the branch name wrong. It is fl.stgit not fl.stg. >> But the error message sent me off in the wrong direction looking for an answer. > > I think this would help. I used "remote ref does not exist" > because that is the simplest explanation for the user. > However, given that we will try to push a fully qualified > ref that does not exist, a more accurate message might > "destination refspec did not match" or something similar. I > prefer the former, though, as it less arcane. > > remote.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/remote.c b/remote.c > index 6833538..04fd9ea 100644 > --- a/remote.c > +++ b/remote.c > @@ -1100,6 +1100,9 @@ static int match_explicit(struct ref *src, struct ref *dst, > case 0: > if (!memcmp(dst_value, "refs/", 5)) > matched_dst = make_linked_ref(dst_value, dst_tail); > + else if (is_null_sha1(matched_src->new_sha1)) > + error("unable to delete '%s': remote ref does not exist", > + dst_value); > else if ((dst_guess = guess_ref(dst_value, matched_src))) > matched_dst = make_linked_ref(dst_guess, dst_tail); > else > -- > 1.7.11.rc1.21.g3c8d91e > -- Jon Smirl jonsmirl@gmail.com ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] push: don't guess at qualifying remote refs on deletion 2012-07-03 18:34 ` jonsmirl @ 2012-07-03 18:40 ` Jeff King 2012-07-03 18:43 ` jonsmirl 2012-07-04 7:21 ` Carlos Martín Nieto 0 siblings, 2 replies; 17+ messages in thread From: Jeff King @ 2012-07-03 18:40 UTC (permalink / raw) To: jonsmirl@gmail.com; +Cc: Junio C Hamano, Git Mailing List On Tue, Jul 03, 2012 at 02:34:59PM -0400, jonsmirl@gmail.com wrote: > > and now: > > > > $ git push origin :bogus > > error: unable to delete 'bogus': remote ref does not exist > > error: failed to push some refs to '$URL' > > This error return would have made my mistake obvious. Thanks for confirming. > Might want to add a paragraph to the doc saying this is how you delete > remote branches since it is not an obvious solution. I found it via > Google and a question asked on stackoverflow.com It's already in git-push(1): OPTIONS ... <refspec> ... Pushing an empty <src> allows you to delete the <dst> ref from the remote repository. but if you have rewording suggestions, or a suggestion as to where else to mention it, please do. -Peff ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] push: don't guess at qualifying remote refs on deletion 2012-07-03 18:40 ` Jeff King @ 2012-07-03 18:43 ` jonsmirl 2012-07-03 19:35 ` Jeff King 2012-07-04 7:21 ` Carlos Martín Nieto 1 sibling, 1 reply; 17+ messages in thread From: jonsmirl @ 2012-07-03 18:43 UTC (permalink / raw) To: Jeff King; +Cc: Junio C Hamano, Git Mailing List On Tue, Jul 3, 2012 at 2:40 PM, Jeff King <peff@peff.net> wrote: > On Tue, Jul 03, 2012 at 02:34:59PM -0400, jonsmirl@gmail.com wrote: > >> > and now: >> > >> > $ git push origin :bogus >> > error: unable to delete 'bogus': remote ref does not exist >> > error: failed to push some refs to '$URL' >> >> This error return would have made my mistake obvious. > > Thanks for confirming. > >> Might want to add a paragraph to the doc saying this is how you delete >> remote branches since it is not an obvious solution. I found it via >> Google and a question asked on stackoverflow.com > > It's already in git-push(1): > > OPTIONS > ... > <refspec> > ... > Pushing an empty <src> allows you to delete the <dst> ref from I was searching for "git delete remote branch". Can out add the word 'branch' in so that Google will find it? > the remote repository. > > but if you have rewording suggestions, or a suggestion as to where else > to mention it, please do. > > -Peff -- Jon Smirl jonsmirl@gmail.com ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] push: don't guess at qualifying remote refs on deletion 2012-07-03 18:43 ` jonsmirl @ 2012-07-03 19:35 ` Jeff King 0 siblings, 0 replies; 17+ messages in thread From: Jeff King @ 2012-07-03 19:35 UTC (permalink / raw) To: jonsmirl@gmail.com; +Cc: Junio C Hamano, Git Mailing List On Tue, Jul 03, 2012 at 02:43:01PM -0400, jonsmirl@gmail.com wrote: > > It's already in git-push(1): > > > > OPTIONS > > ... > > <refspec> > > ... > > Pushing an empty <src> allows you to delete the <dst> ref from > > I was searching for "git delete remote branch". Can out add the word > 'branch' in so that Google will find it? I didn't quite parse what you were saying here. -Peff ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] push: don't guess at qualifying remote refs on deletion 2012-07-03 18:40 ` Jeff King 2012-07-03 18:43 ` jonsmirl @ 2012-07-04 7:21 ` Carlos Martín Nieto [not found] ` <CABURp0rVPAvxP1sp_nmoNYd+F+OsvWeHgUAeo7-VTnQhdebFeg@mail.gmail.com> 1 sibling, 1 reply; 17+ messages in thread From: Carlos Martín Nieto @ 2012-07-04 7:21 UTC (permalink / raw) To: Jeff King; +Cc: jonsmirl@gmail.com, Junio C Hamano, Git Mailing List On Tue, 2012-07-03 at 14:40 -0400, Jeff King wrote: > On Tue, Jul 03, 2012 at 02:34:59PM -0400, jonsmirl@gmail.com wrote: > > > > and now: > > > > > > $ git push origin :bogus > > > error: unable to delete 'bogus': remote ref does not exist > > > error: failed to push some refs to '$URL' > > > > This error return would have made my mistake obvious. > > Thanks for confirming. > > > Might want to add a paragraph to the doc saying this is how you delete > > remote branches since it is not an obvious solution. I found it via > > Google and a question asked on stackoverflow.com > > It's already in git-push(1): > > OPTIONS > ... > <refspec> > ... > Pushing an empty <src> allows you to delete the <dst> ref from > the remote repository. > There is also a flag you can pass, which you can see a few paragraphs under it which. It explains what it does underneath but removes the need to know that an empty source will delete the ref. --delete All listed refs are deleted from the remote repository. This is the same as prefixing all refs with a colon. I suppose "delete" rather than "remove" as we have for remotes could cause some confusion, as it's inconsistent, but it's all there in the manpage. cmn ^ permalink raw reply [flat|nested] 17+ messages in thread
[parent not found: <CABURp0rVPAvxP1sp_nmoNYd+F+OsvWeHgUAeo7-VTnQhdebFeg@mail.gmail.com>]
* Re: [PATCH] push: don't guess at qualifying remote refs on deletion [not found] ` <CABURp0rVPAvxP1sp_nmoNYd+F+OsvWeHgUAeo7-VTnQhdebFeg@mail.gmail.com> @ 2012-07-05 7:22 ` Carlos Martín Nieto 2012-07-05 15:32 ` Phil Hord 0 siblings, 1 reply; 17+ messages in thread From: Carlos Martín Nieto @ 2012-07-05 7:22 UTC (permalink / raw) To: Phil Hord; +Cc: Jeff King, jonsmirl@gmail.com, Git Mailing List, Junio C Hamano On Wed, 2012-07-04 at 22:23 -0400, Phil Hord wrote: > > On Jul 4, 2012 3:22 AM, "Carlos Martín Nieto" <cmn@elego.de> wrote: > > > > On Tue, 2012-07-03 at 14:40 -0400, Jeff King wrote: > > > On Tue, Jul 03, 2012 at 02:34:59PM -0400, jonsmirl@gmail.com > wrote: > > > > > > > > and now: > > > > > > > > > > $ git push origin :bogus > > > > > error: unable to delete 'bogus': remote ref does not exist > > > > > error: failed to push some refs to '$URL' > > > > > > > > This error return would have made my mistake obvious. > > > > > > Thanks for confirming. > > > > > > > Might want to add a paragraph to the doc saying this is how you > delete > > > > remote branches since it is not an obvious solution. I found it > via > > > > Google and a question asked on stackoverflow.com > > > > > > It's already in git-push(1): > > > > > > OPTIONS > > > ... > > > <refspec> > > > ... > > > Pushing an empty <src> allows you to delete the <dst> ref > from > > > the remote repository. > > > > > > > There is also a flag you can pass, which you can see a few > paragraphs > > under it which. It explains what it does underneath but removes the > need > > to know that an empty source will delete the ref. > > > > --delete > > All listed refs are deleted from the remote repository. This > is > > the same as prefixing all refs with a colon. > > > I do like that, but I agree with OP that 'git push' is not an obvious > to look for delete branch functionality for new users. Like it? I don't get what you mean, it's a quote of what's already there. The reason that it's in git-push is because that's the only git command that modifies another repository. There isn't another git command where it would fit. You could try to put it somewhere under git-remote, but then you'd have a single subcommand that affects a remote among a lot of others that don't, introducing an inconsistency in the command. cmn ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] push: don't guess at qualifying remote refs on deletion 2012-07-05 7:22 ` Carlos Martín Nieto @ 2012-07-05 15:32 ` Phil Hord 2012-07-05 17:24 ` Carlos Martín Nieto 2012-07-05 17:26 ` Junio C Hamano 0 siblings, 2 replies; 17+ messages in thread From: Phil Hord @ 2012-07-05 15:32 UTC (permalink / raw) To: Carlos Martín Nieto Cc: Jeff King, jonsmirl@gmail.com, Git Mailing List, Junio C Hamano >> > There is also a flag you can pass, which you can see a few >> paragraphs >> > under it which. It explains what it does underneath but removes the >> need >> > to know that an empty source will delete the ref. >> > >> > --delete >> > All listed refs are deleted from the remote repository. This >> is >> > the same as prefixing all refs with a colon. >> >> >> I do like that, but I agree with OP that 'git push' is not an obvious >> to look for delete branch functionality for new users. s/obvious/obvious place/ > Like it? I don't get what you mean, it's a quote of what's already > there. Yes. I didn't mean I like "the change". I meant that I appreciate this being in the documentation. But it seems insufficient. > The reason that it's in git-push is because that's the only git command > that modifies another repository. There isn't another git command where > it would fit. Yes, and that's why I said, in the part of my email you did not quote: "I do not have a good suggestion for improving the situation, however." > You could try to put it somewhere under git-remote, but > then you'd have a single subcommand that affects a remote among a lot of > others that don't, introducing an inconsistency in the command. git-remote is the wrong place for anything like this. I think git-push is really the correct place for it. I do not think it should be moved. But this is a common problem in git for newbies, I think. Features are in "the right place" in the command structure, but it is difficult to find where that right place is when you are new to the system, especially when the feature is tucked neatly away as a switch on some other feature. The possible enhancements to cover this I can think of are mostly in the form of enhanced help or advice. For example, I could imagine these: 1. Add a link to 'git push' on the 'git-branch' man page. I suspect this is where newbies would go to look for this feature, but I am only guessing. The git-branch help discusses deleting branches and even deleting remote-tracking branches. But it does not discuss deleting branches on a remote repository, even to say "this is not the command you want" for that action, but "see this other one instead". 2. Add 'apropos' behavior for git help. $ git apropos delete Except I notice that the system 'apropos' does not turn up 'git-push' for either of these: $ apropos delete $ apropos branch 3. Add a search feature for help. Currently this feature is provided instead by Google and StackOverflow. $ git help --find delete --and branch --and remote Except I don't expect this "advanced" form of help, if it existed, to be noticed by newbies early enough on the learning curve. 4. Add advice in appropriate locations. Instead of this: $ git remote rm origin/foo error: Could not remove config section 'remote.origin/foo' $ git branch -d origin/foo error: branch 'origin/foo' not found. Do this: $ git remote rm origin/foo error: There is no remote named 'origin/foo' hint: Did you mean to remove the remote tracking branch 'origin/foo'? hint: Try "git branch --delete --remotes origin/foo" instead. hint: Did you mean to remove the branch 'foo' on the remote 'origin' repository? hint: Try "git push --delete origin foo" instead. $ git branch -d origin/foo error: branch 'origin/foo' not found. hint: To delete the remote-tracking branch origin/foo, hint: use git branch --delete --remotes origin/foo $ git branch -dr origin/foo Deleted remote branch origin/foo (was fadda12). hint: This deleted your remote-tracking branch but hint: did not affect the branch on the remote server. hint: To remove the branch from the remote server, hint: use "git push". See '--delete' in "git help push" . I rather like this last bit. I'll try to roll a patch later on. Phil ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] push: don't guess at qualifying remote refs on deletion 2012-07-05 15:32 ` Phil Hord @ 2012-07-05 17:24 ` Carlos Martín Nieto 2012-07-05 17:26 ` Junio C Hamano 1 sibling, 0 replies; 17+ messages in thread From: Carlos Martín Nieto @ 2012-07-05 17:24 UTC (permalink / raw) To: Phil Hord; +Cc: Jeff King, jonsmirl@gmail.com, Git Mailing List, Junio C Hamano On Thu, 2012-07-05 at 11:32 -0400, Phil Hord wrote: > > The possible enhancements to cover this I can think of are mostly in > the form of enhanced help or advice. For example, I could imagine > these: > > 1. Add a link to 'git push' on the 'git-branch' man page. I suspect > this is where newbies would go to look for this feature, but I am only > guessing. The git-branch help discusses deleting branches and even > deleting remote-tracking branches. But it does not discuss deleting > branches on a remote repository, even to say "this is not the command > you want" for that action, but "see this other one instead". Yeah, that seems like a good addition. > > 2. Add 'apropos' behavior for git help. > $ git apropos delete > > Except I notice that the system 'apropos' does not turn up 'git-push' > for either of these: > $ apropos delete > $ apropos branch Huh, I don't think I've used apropos in years. I guess changing the subject to include removing/deleting would be conceivable, but we still have the issue that branches are a particular form of ref, which is what push acts on. > > 3. Add a search feature for help. Currently this feature is provided > instead by Google and StackOverflow. > $ git help --find delete --and branch --and remote > Except I don't expect this "advanced" form of help, if it existed, to > be noticed by newbies early enough on the learning curve. > > 4. Add advice in appropriate locations. > Instead of this: > $ git remote rm origin/foo > error: Could not remove config section 'remote.origin/foo' Ugh, this is horrible. We should definitely do better than this error message. > $ git branch -d origin/foo > error: branch 'origin/foo' not found. > > Do this: > $ git remote rm origin/foo > error: There is no remote named 'origin/foo' > hint: Did you mean to remove the remote tracking branch 'origin/foo'? > hint: Try "git branch --delete --remotes origin/foo" instead. > hint: Did you mean to remove the branch 'foo' on the remote > 'origin' repository? > hint: Try "git push --delete origin foo" instead. > > $ git branch -d origin/foo > error: branch 'origin/foo' not found. > hint: To delete the remote-tracking branch origin/foo, > hint: use git branch --delete --remotes origin/foo > > $ git branch -dr origin/foo > Deleted remote branch origin/foo (was fadda12). If we're changing error messages, this could probably do with an update to say "remote-tracking" branch so it's clearer that it didn't affect the branch on the remote. > hint: This deleted your remote-tracking branch but > hint: did not affect the branch on the remote server. > hint: To remove the branch from the remote server, > hint: use "git push". See '--delete' in "git help push" . > IMO these seem too verbose (but maybe I've just seen people post the old 'git pull' error message without even reading it too many times). cmn ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] push: don't guess at qualifying remote refs on deletion 2012-07-05 15:32 ` Phil Hord 2012-07-05 17:24 ` Carlos Martín Nieto @ 2012-07-05 17:26 ` Junio C Hamano 1 sibling, 0 replies; 17+ messages in thread From: Junio C Hamano @ 2012-07-05 17:26 UTC (permalink / raw) To: Phil Hord Cc: Carlos Martín Nieto, Jeff King, jonsmirl@gmail.com, Git Mailing List Phil Hord <phil.hord@gmail.com> writes: > The possible enhancements to cover this I can think of are mostly in > the form of enhanced help or advice. For example, I could imagine > these: Thanks; I agree discoverability is the key for any large toolset. > 1. Add a link to 'git push' on the 'git-branch' man page. I suspect > this is where newbies would go to look for this feature, but I am only > guessing. The git-branch help discusses deleting branches and even > deleting remote-tracking branches. But it does not discuss deleting > branches on a remote repository, even to say "this is not the command > you want" for that action, but "see this other one instead". Or you can enhance the link to "git push" from "git" manpage (which hopefully exists already), to make it clear that everything that affects branches and tags that appear at a remote site is done via that command. > 2. Add 'apropos' behavior for git help. > $ git apropos delete > ... > 3. Add a search feature for help. Currently this feature is provided > instead by Google and StackOverflow. > $ git help --find delete --and branch --and remote > Except I don't expect this "advanced" form of help, if it existed, to > be noticed by newbies early enough on the learning curve. I think you may be onto something here. I can see that we could help "git help -k delete" (modeled after "man -k") by adding keywords to the documentation pages. > 4. Add advice in appropriate locations. I have to say that I am fairly negative on any attempt to anticipate and list all the irrelevant possibilities that could come from misunderstandings; it will lead to unreadable mess. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] push: don't guess at qualifying remote refs on deletion 2012-07-03 18:04 ` [PATCH] push: don't guess at qualifying remote refs on deletion Jeff King 2012-07-03 18:34 ` jonsmirl @ 2012-07-03 19:38 ` Junio C Hamano 2012-07-04 7:37 ` Jeff King 1 sibling, 1 reply; 17+ messages in thread From: Junio C Hamano @ 2012-07-03 19:38 UTC (permalink / raw) To: Jeff King; +Cc: jonsmirl@gmail.com, Git Mailing List Jeff King <peff@peff.net> writes: > Instead, we can just be more succinct and say "we can't > delete this because we couldn't find it". So before: > > $ git push origin :bogus > error: unable to push to unqualified destination: bogus > 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 '$URL' > > and now: > > $ git push origin :bogus > error: unable to delete 'bogus': remote ref does not exist > error: failed to push some refs to '$URL' This is telling a truth ($GIT_DIR/refs/bogus does not exist) but not the whole truth; while I tend to agree that it is better than the original (especially with ", and we are unable to guess..." part), given that the above request would delete refs/tags/bogus or refs/heads/bogus if they existed on the "origin", I am a bit worried that it may send an incorrect message to novice users. unable to delete 'bogus': no branch or tag with that name might allay my worries, but I am not extremely happy with that wording, either. > I think this would help. I used "remote ref does not exist" > because that is the simplest explanation for the user. > However, given that we will try to push a fully qualified > ref that does not exist, a more accurate message might > "destination refspec did not match" or something similar. I > prefer the former, though, as it less arcane. Yeah, I do understand why you phrased that way, but still.. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] push: don't guess at qualifying remote refs on deletion 2012-07-03 19:38 ` Junio C Hamano @ 2012-07-04 7:37 ` Jeff King 0 siblings, 0 replies; 17+ messages in thread From: Jeff King @ 2012-07-04 7:37 UTC (permalink / raw) To: Junio C Hamano; +Cc: jonsmirl@gmail.com, Git Mailing List On Tue, Jul 03, 2012 at 12:38:10PM -0700, Junio C Hamano wrote: > Jeff King <peff@peff.net> writes: > > > Instead, we can just be more succinct and say "we can't > > delete this because we couldn't find it". So before: > > > > $ git push origin :bogus > > error: unable to push to unqualified destination: bogus > > 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 '$URL' > > > > and now: > > > > $ git push origin :bogus > > error: unable to delete 'bogus': remote ref does not exist > > error: failed to push some refs to '$URL' > > This is telling a truth ($GIT_DIR/refs/bogus does not exist) but not > the whole truth; while I tend to agree that it is better than the > original (especially with ", and we are unable to guess..." part), > given that the above request would delete refs/tags/bogus or > refs/heads/bogus if they existed on the "origin", I am a bit worried > that it may send an incorrect message to novice users. > > unable to delete 'bogus': no branch or tag with that name > > might allay my worries, but I am not extremely happy with that > wording, either. I think the most accurate explanation of the behavior is "the destination refspec does not match an existing ref, and it is not fully qualified, so I didn't know what you meant to delete". But that is a pretty awful message (only slightly less awful than the original one, but I think that one is pretty bad). The really interesting part is that we tried to match "bogus" against all of the usual ref lookup rules, and it didn't match anything. But we have the same issue when we say "git show bogus" and it does not match anything, and we simply say "bad revision 'bogus'". Maybe: unable to delete 'bogus': no matching remote ref found would be a reasonably short way of saying that? That still leaves out the second half, that it was not fully qualified and therefore we could not even transmit an attempt to delete (even though that attempt would clearly not succeed!). But that is really not a subtlety that I think is worth putting in the error message, as it is way more likely to confuse somebody. -Peff ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: How do I delete a remote branch with a period in the name? 2012-07-03 3:09 How do I delete a remote branch with a period in the name? jonsmirl 2012-07-03 4:14 ` Junio C Hamano @ 2012-07-03 7:56 ` Andreas Schwab 2012-07-03 19:39 ` Junio C Hamano 1 sibling, 1 reply; 17+ messages in thread From: Andreas Schwab @ 2012-07-03 7:56 UTC (permalink / raw) To: jonsmirl@gmail.com; +Cc: Git Mailing List "jonsmirl@gmail.com" <jonsmirl@gmail.com> writes: > jonsmirl@smirl2:/home/apps/florida/lpc31xx$ git push origin :fl.stg > error: unable to push to unqualified destination: fl.stg > 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 'git@github.com:jonsmirl/lpc31xx.git' > jonsmirl@smirl2:/home/apps/florida/lpc31xx$ > > jonsmirl@smirl2:/home/apps/florida/lpc31xx$ git branch -r > linus/master > origin/HEAD -> origin/master > origin/bar.stgit > origin/dt-test > origin/fl.stgit > origin/foo.stgit > origin/lpc313x-stg > origin/lpc313x-stg.stgit > origin/master > origin/master.stgit > origin/temp.stgit > origin/v3.4-stg > origin/v3.4-stg.stgit > origin/v3.5-stg > origin/v3.5-stg.stgit There doesn't appear to be a remote branch with that name. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: How do I delete a remote branch with a period in the name? 2012-07-03 7:56 ` How do I delete a remote branch with a period in the name? Andreas Schwab @ 2012-07-03 19:39 ` Junio C Hamano 0 siblings, 0 replies; 17+ messages in thread From: Junio C Hamano @ 2012-07-03 19:39 UTC (permalink / raw) To: Andreas Schwab; +Cc: jonsmirl@gmail.com, Git Mailing List Andreas Schwab <schwab@linux-m68k.org> writes: > "jonsmirl@gmail.com" <jonsmirl@gmail.com> writes: > >> jonsmirl@smirl2:/home/apps/florida/lpc31xx$ git push origin :fl.stg >> error: unable to push to unqualified destination: fl.stg >> 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 'git@github.com:jonsmirl/lpc31xx.git' >> jonsmirl@smirl2:/home/apps/florida/lpc31xx$ >> >> jonsmirl@smirl2:/home/apps/florida/lpc31xx$ git branch -r >> linus/master >> origin/HEAD -> origin/master >> origin/bar.stgit >> origin/dt-test >> origin/fl.stgit >> origin/foo.stgit >> origin/lpc313x-stg >> origin/lpc313x-stg.stgit >> origin/master >> origin/master.stgit >> origin/temp.stgit >> origin/v3.4-stg >> origin/v3.4-stg.stgit >> origin/v3.5-stg >> origin/v3.5-stg.stgit > > There doesn't appear to be a remote branch with that name. More importantly, there was nothing in Jon's message to convince us that "branch -r" outputis telling us the current state of the remote. Showing "ls-remote" output would have been better. ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2012-07-05 17:26 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-07-03 3:09 How do I delete a remote branch with a period in the name? jonsmirl 2012-07-03 4:14 ` Junio C Hamano 2012-07-03 11:42 ` jonsmirl 2012-07-03 18:04 ` [PATCH] push: don't guess at qualifying remote refs on deletion Jeff King 2012-07-03 18:34 ` jonsmirl 2012-07-03 18:40 ` Jeff King 2012-07-03 18:43 ` jonsmirl 2012-07-03 19:35 ` Jeff King 2012-07-04 7:21 ` Carlos Martín Nieto [not found] ` <CABURp0rVPAvxP1sp_nmoNYd+F+OsvWeHgUAeo7-VTnQhdebFeg@mail.gmail.com> 2012-07-05 7:22 ` Carlos Martín Nieto 2012-07-05 15:32 ` Phil Hord 2012-07-05 17:24 ` Carlos Martín Nieto 2012-07-05 17:26 ` Junio C Hamano 2012-07-03 19:38 ` Junio C Hamano 2012-07-04 7:37 ` Jeff King 2012-07-03 7:56 ` How do I delete a remote branch with a period in the name? Andreas Schwab 2012-07-03 19:39 ` Junio C Hamano
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).