{"thread":{"id":"40990","subject":"[PATCH 1/2] push: add '--delete' flag to synopsis","startedAt":"2015-12-14T15:23:03Z","lastAt":"2015-12-16T21:52:52Z","messageCount":7,"participants":["Patrick Steinhardt","Junio C Hamano","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"274379","messageId":"1450106584-22313-1-git-send-email-ps@pks.im","threadId":"40990","inReplyTo":null,"subject":"[PATCH 1/2] push: add '--delete' flag to synopsis","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2015-12-14T15:23:03Z","receivedAt":"2015-12-14T15:23:03Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"The delete flag is not mentioned in the synopsis of `git-push`.\nAdd the flag to make it more discoverable.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n Documentation/git-push.txt | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-push.txt b/Documentation/git-push.txt\nindex 85a4d7d..e830c08 100644\n--- a/Documentation/git-push.txt\n+++ b/Documentation/git-push.txt\n@@ -10,7 +10,7 @@ SYNOPSIS\n --------\n [verse]\n 'git push' [--all | --mirror | --tags] [--follow-tags] [--atomic] [-n | --dry-run] [--receive-pack=<git-receive-pack>]\n-\t   [--repo=<repository>] [-f | --force] [--prune] [-v | --verbose]\n+\t   [--repo=<repository>] [-f | --force] [--delete] [--prune] [-v | --verbose]\n \t   [-u | --set-upstream]\n \t   [--[no-]signed|--sign=(true|false|if-asked)]\n \t   [--force-with-lease[=<refname>[:<expect>]]]\n-- \n2.6.4\n"},{"id":"274380","messageId":"1450106584-22313-2-git-send-email-ps@pks.im","threadId":"40990","inReplyTo":"1450106584-22313-1-git-send-email-ps@pks.im","subject":"[PATCH 2/2] push: add '-d' as shorthand for '--delete'","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2015-12-14T15:23:04Z","receivedAt":"2015-12-14T15:23:04Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"It is only possible to delete branches on remotes by specifying\nthe long '--delete' flag. The `git-branch` command, which can be\nused to delete local branches with the same '--delete' flag, also\naccepts the shorthand '-d'. This may cause confusion for users\nwhich are frequently using the shorthand form of deleting local\nbranches and subsequently try to use the same shorthand for\n`git-push`, which will fail.\n\nFix this usability issue by adding the '-d' shorthand to\n`git-push` and document it.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n Documentation/git-push.txt | 2 +-\n builtin/push.c             | 2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-push.txt b/Documentation/git-push.txt\nindex e830c08..6f5d98c 100644\n--- a/Documentation/git-push.txt\n+++ b/Documentation/git-push.txt\n@@ -10,7 +10,7 @@ SYNOPSIS\n --------\n [verse]\n 'git push' [--all | --mirror | --tags] [--follow-tags] [--atomic] [-n | --dry-run] [--receive-pack=<git-receive-pack>]\n-\t   [--repo=<repository>] [-f | --force] [--delete] [--prune] [-v | --verbose]\n+\t   [--repo=<repository>] [-f | --force] [-d | --delete] [--prune] [-v | --verbose]\n \t   [-u | --set-upstream]\n \t   [--[no-]signed|--sign=(true|false|if-asked)]\n \t   [--force-with-lease[=<refname>[:<expect>]]]\ndiff --git a/builtin/push.c b/builtin/push.c\nindex 3bda430..093011d 100644\n--- a/builtin/push.c\n+++ b/builtin/push.c\n@@ -540,7 +540,7 @@ int cmd_push(int argc, const char **argv, const char *prefix)\n \t\tOPT_BIT( 0 , \"all\", &flags, N_(\"push all refs\"), TRANSPORT_PUSH_ALL),\n \t\tOPT_BIT( 0 , \"mirror\", &flags, N_(\"mirror all refs\"),\n \t\t\t    (TRANSPORT_PUSH_MIRROR|TRANSPORT_PUSH_FORCE)),\n-\t\tOPT_BOOL( 0, \"delete\", &deleterefs, N_(\"delete refs\")),\n+\t\tOPT_BOOL('d', \"delete\", &deleterefs, N_(\"delete refs\")),\n \t\tOPT_BOOL( 0 , \"tags\", &tags, N_(\"push tags (can't be used with --all or --mirror)\")),\n \t\tOPT_BIT('n' , \"dry-run\", &flags, N_(\"dry run\"), TRANSPORT_PUSH_DRY_RUN),\n \t\tOPT_BIT( 0,  \"porcelain\", &flags, N_(\"machine-readable output\"), TRANSPORT_PUSH_PORCELAIN),\n-- \n2.6.4\n"},{"id":"274397","messageId":"xmqqegeokfet.fsf@gitster.mtv.corp.google.com","threadId":"40990","inReplyTo":"1450106584-22313-2-git-send-email-ps@pks.im","subject":"Re: [PATCH 2/2] push: add '-d' as shorthand for '--delete'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-12-14T19:18:18Z","receivedAt":"2015-12-14T19:18:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Patrick Steinhardt <ps@pks.im> writes:\n\n> It is only possible to delete branches on remotes by specifying\n> the long '--delete' flag.\n\nNot really.  \"git push origin :unnecessary-branch\" should just work\nwith out \"--delete\" or \"-d\".\n"},{"id":"274435","messageId":"20151214211856.GF14788@sigill.intra.peff.net","threadId":"40990","inReplyTo":"1450106584-22313-2-git-send-email-ps@pks.im","subject":"Re: [PATCH 2/2] push: add '-d' as shorthand for '--delete'","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2015-12-14T21:18:57Z","receivedAt":"2015-12-14T21:18:57Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Dec 14, 2015 at 04:23:04PM +0100, Patrick Steinhardt wrote:\n\n> It is only possible to delete branches on remotes by specifying\n> the long '--delete' flag. The `git-branch` command, which can be\n> used to delete local branches with the same '--delete' flag, also\n> accepts the shorthand '-d'. This may cause confusion for users\n> which are frequently using the shorthand form of deleting local\n> branches and subsequently try to use the same shorthand for\n> `git-push`, which will fail.\n> \n> Fix this usability issue by adding the '-d' shorthand to\n> `git-push` and document it.\n\nI think we didn't give it \"-d\" originally, because we usually avoid\nallocating short-options (which are a limited resource) until an option\nhas proven itself.\n\nAt this point, it seems that \"--delete\" is useful, and nothing else has\nbeen proposed for \"-d\" in the intervening years. It seems like a\nreasonable use of the flag to me.\n\nI have been bitten by this myself. I know about \"git push origin\n:ref-to-delete\", of course, but my brain would much rather type \"-d\"\n(and it's also easier when piping to xargs).\n\n-Peff\n"},{"id":"274482","messageId":"20151215092206.GA1209@pks-xps.elego.de","threadId":"40990","inReplyTo":"xmqqegeokfet.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 2/2] push: add '-d' as shorthand for '--delete'","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2015-12-15T09:22:06Z","receivedAt":"2015-12-15T09:22:06Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Mon, Dec 14, 2015 at 11:18:18AM -0800, Junio C Hamano wrote:\n> Patrick Steinhardt <ps@pks.im> writes:\n> \n> > It is only possible to delete branches on remotes by specifying\n> > the long '--delete' flag.\n> \n> Not really.  \"git push origin :unnecessary-branch\" should just work\n> with out \"--delete\" or \"-d\".\n\nWell, sure, didn't think about this when phrasing the commit\nmessage. Still I think my point stands that it is more convenient\nfor users to also have the '-d' shorthand, as is also in use for\nbranch deletion in `git-branch`. I'll resend this patch with a\ncorrected message.\n\nPatrick\n"},{"id":"274600","messageId":"xmqqr3imcf2l.fsf@gitster.mtv.corp.google.com","threadId":"40990","inReplyTo":"20151214211856.GF14788@sigill.intra.peff.net","subject":"Re: [PATCH 2/2] push: add '-d' as shorthand for '--delete'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-12-16T20:29:38Z","receivedAt":"2015-12-16T20:29:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> At this point, it seems that \"--delete\" is useful, and nothing else has\n> been proposed for \"-d\" in the intervening years. It seems like a\n> reasonable use of the flag to me.\n\nI think there were two (and a half) reasons why we didn't let\n\"--delete\" use a short-and-sweet \"-d\", and I agree that \"something\nelse that is more useful did not come\" removes one of them.\n\nThe other reason was to avoid the chance of fat-fingering, because\ndeleting is destructive, and it is even harder to recover from if\nthe damage is done remotely (and the remaining one-half is that\ndeleting is a rare event).\n\nEven though I do not think the need for the \"safety\" has been\nreduced over time to warrant this change, a similarity with \"branch\"\nthat has \"-d/--delete\" would be a good enough argument to support\nthis change.\n\nThanks.\n"},{"id":"274610","messageId":"20151216215252.GA11615@sigill.intra.peff.net","threadId":"40990","inReplyTo":"xmqqr3imcf2l.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 2/2] push: add '-d' as shorthand for '--delete'","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2015-12-16T21:52:52Z","receivedAt":"2015-12-16T21:52:52Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Dec 16, 2015 at 12:29:38PM -0800, Junio C Hamano wrote:\n\n> Jeff King <peff@peff.net> writes:\n> \n> > At this point, it seems that \"--delete\" is useful, and nothing else has\n> > been proposed for \"-d\" in the intervening years. It seems like a\n> > reasonable use of the flag to me.\n> \n> I think there were two (and a half) reasons why we didn't let\n> \"--delete\" use a short-and-sweet \"-d\", and I agree that \"something\n> else that is more useful did not come\" removes one of them.\n> \n> The other reason was to avoid the chance of fat-fingering, because\n> deleting is destructive, and it is even harder to recover from if\n> the damage is done remotely (and the remaining one-half is that\n> deleting is a rare event).\n> \n> Even though I do not think the need for the \"safety\" has been\n> reduced over time to warrant this change, a similarity with \"branch\"\n> that has \"-d/--delete\" would be a good enough argument to support\n> this change.\n\nThanks for the input, I hadn't considered \"safety\" at all. We do have\nsafety measures on \"git branch -d\" that we don't have here. I guess we\ncould implement something similar (e.g., see if the to-be-deleted branch\nis merged elsewhere; of course we might not have the objects locally at\nall). On the other hand, you can already screw yourself pretty badly\nwith \"push -f\".\n\nSo I think it's probably OK to add \"-d\".\n\n-Peff\n"}]}