* [PATCH 1/2] push: add '--delete' flag to synopsis @ 2015-12-14 15:23 Patrick Steinhardt 2015-12-14 15:23 ` [PATCH 2/2] push: add '-d' as shorthand for '--delete' Patrick Steinhardt 0 siblings, 1 reply; 7+ messages in thread From: Patrick Steinhardt @ 2015-12-14 15:23 UTC (permalink / raw) To: git; +Cc: ps The delete flag is not mentioned in the synopsis of `git-push`. Add the flag to make it more discoverable. Signed-off-by: Patrick Steinhardt <ps@pks.im> --- Documentation/git-push.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt index 85a4d7d..e830c08 100644 --- a/Documentation/git-push.txt +++ b/Documentation/git-push.txt @@ -10,7 +10,7 @@ SYNOPSIS -------- [verse] 'git push' [--all | --mirror | --tags] [--follow-tags] [--atomic] [-n | --dry-run] [--receive-pack=<git-receive-pack>] - [--repo=<repository>] [-f | --force] [--prune] [-v | --verbose] + [--repo=<repository>] [-f | --force] [--delete] [--prune] [-v | --verbose] [-u | --set-upstream] [--[no-]signed|--sign=(true|false|if-asked)] [--force-with-lease[=<refname>[:<expect>]]] -- 2.6.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] push: add '-d' as shorthand for '--delete' 2015-12-14 15:23 [PATCH 1/2] push: add '--delete' flag to synopsis Patrick Steinhardt @ 2015-12-14 15:23 ` Patrick Steinhardt 2015-12-14 19:18 ` Junio C Hamano 2015-12-14 21:18 ` Jeff King 0 siblings, 2 replies; 7+ messages in thread From: Patrick Steinhardt @ 2015-12-14 15:23 UTC (permalink / raw) To: git; +Cc: ps It is only possible to delete branches on remotes by specifying the long '--delete' flag. The `git-branch` command, which can be used to delete local branches with the same '--delete' flag, also accepts the shorthand '-d'. This may cause confusion for users which are frequently using the shorthand form of deleting local branches and subsequently try to use the same shorthand for `git-push`, which will fail. Fix this usability issue by adding the '-d' shorthand to `git-push` and document it. Signed-off-by: Patrick Steinhardt <ps@pks.im> --- Documentation/git-push.txt | 2 +- builtin/push.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt index e830c08..6f5d98c 100644 --- a/Documentation/git-push.txt +++ b/Documentation/git-push.txt @@ -10,7 +10,7 @@ SYNOPSIS -------- [verse] 'git push' [--all | --mirror | --tags] [--follow-tags] [--atomic] [-n | --dry-run] [--receive-pack=<git-receive-pack>] - [--repo=<repository>] [-f | --force] [--delete] [--prune] [-v | --verbose] + [--repo=<repository>] [-f | --force] [-d | --delete] [--prune] [-v | --verbose] [-u | --set-upstream] [--[no-]signed|--sign=(true|false|if-asked)] [--force-with-lease[=<refname>[:<expect>]]] diff --git a/builtin/push.c b/builtin/push.c index 3bda430..093011d 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -540,7 +540,7 @@ int cmd_push(int argc, const char **argv, const char *prefix) OPT_BIT( 0 , "all", &flags, N_("push all refs"), TRANSPORT_PUSH_ALL), OPT_BIT( 0 , "mirror", &flags, N_("mirror all refs"), (TRANSPORT_PUSH_MIRROR|TRANSPORT_PUSH_FORCE)), - OPT_BOOL( 0, "delete", &deleterefs, N_("delete refs")), + OPT_BOOL('d', "delete", &deleterefs, N_("delete refs")), OPT_BOOL( 0 , "tags", &tags, N_("push tags (can't be used with --all or --mirror)")), OPT_BIT('n' , "dry-run", &flags, N_("dry run"), TRANSPORT_PUSH_DRY_RUN), OPT_BIT( 0, "porcelain", &flags, N_("machine-readable output"), TRANSPORT_PUSH_PORCELAIN), -- 2.6.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] push: add '-d' as shorthand for '--delete' 2015-12-14 15:23 ` [PATCH 2/2] push: add '-d' as shorthand for '--delete' Patrick Steinhardt @ 2015-12-14 19:18 ` Junio C Hamano 2015-12-15 9:22 ` Patrick Steinhardt 2015-12-14 21:18 ` Jeff King 1 sibling, 1 reply; 7+ messages in thread From: Junio C Hamano @ 2015-12-14 19:18 UTC (permalink / raw) To: Patrick Steinhardt; +Cc: git Patrick Steinhardt <ps@pks.im> writes: > It is only possible to delete branches on remotes by specifying > the long '--delete' flag. Not really. "git push origin :unnecessary-branch" should just work with out "--delete" or "-d". ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] push: add '-d' as shorthand for '--delete' 2015-12-14 19:18 ` Junio C Hamano @ 2015-12-15 9:22 ` Patrick Steinhardt 0 siblings, 0 replies; 7+ messages in thread From: Patrick Steinhardt @ 2015-12-15 9:22 UTC (permalink / raw) To: Junio C Hamano; +Cc: git [-- Attachment #1: Type: text/plain, Size: 610 bytes --] On Mon, Dec 14, 2015 at 11:18:18AM -0800, Junio C Hamano wrote: > Patrick Steinhardt <ps@pks.im> writes: > > > It is only possible to delete branches on remotes by specifying > > the long '--delete' flag. > > Not really. "git push origin :unnecessary-branch" should just work > with out "--delete" or "-d". Well, sure, didn't think about this when phrasing the commit message. Still I think my point stands that it is more convenient for users to also have the '-d' shorthand, as is also in use for branch deletion in `git-branch`. I'll resend this patch with a corrected message. Patrick [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] push: add '-d' as shorthand for '--delete' 2015-12-14 15:23 ` [PATCH 2/2] push: add '-d' as shorthand for '--delete' Patrick Steinhardt 2015-12-14 19:18 ` Junio C Hamano @ 2015-12-14 21:18 ` Jeff King 2015-12-16 20:29 ` Junio C Hamano 1 sibling, 1 reply; 7+ messages in thread From: Jeff King @ 2015-12-14 21:18 UTC (permalink / raw) To: Patrick Steinhardt; +Cc: Junio C Hamano, git On Mon, Dec 14, 2015 at 04:23:04PM +0100, Patrick Steinhardt wrote: > It is only possible to delete branches on remotes by specifying > the long '--delete' flag. The `git-branch` command, which can be > used to delete local branches with the same '--delete' flag, also > accepts the shorthand '-d'. This may cause confusion for users > which are frequently using the shorthand form of deleting local > branches and subsequently try to use the same shorthand for > `git-push`, which will fail. > > Fix this usability issue by adding the '-d' shorthand to > `git-push` and document it. I think we didn't give it "-d" originally, because we usually avoid allocating short-options (which are a limited resource) until an option has proven itself. At this point, it seems that "--delete" is useful, and nothing else has been proposed for "-d" in the intervening years. It seems like a reasonable use of the flag to me. I have been bitten by this myself. I know about "git push origin :ref-to-delete", of course, but my brain would much rather type "-d" (and it's also easier when piping to xargs). -Peff ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] push: add '-d' as shorthand for '--delete' 2015-12-14 21:18 ` Jeff King @ 2015-12-16 20:29 ` Junio C Hamano 2015-12-16 21:52 ` Jeff King 0 siblings, 1 reply; 7+ messages in thread From: Junio C Hamano @ 2015-12-16 20:29 UTC (permalink / raw) To: Jeff King; +Cc: Patrick Steinhardt, git Jeff King <peff@peff.net> writes: > At this point, it seems that "--delete" is useful, and nothing else has > been proposed for "-d" in the intervening years. It seems like a > reasonable use of the flag to me. I think there were two (and a half) reasons why we didn't let "--delete" use a short-and-sweet "-d", and I agree that "something else that is more useful did not come" removes one of them. The other reason was to avoid the chance of fat-fingering, because deleting is destructive, and it is even harder to recover from if the damage is done remotely (and the remaining one-half is that deleting is a rare event). Even though I do not think the need for the "safety" has been reduced over time to warrant this change, a similarity with "branch" that has "-d/--delete" would be a good enough argument to support this change. Thanks. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] push: add '-d' as shorthand for '--delete' 2015-12-16 20:29 ` Junio C Hamano @ 2015-12-16 21:52 ` Jeff King 0 siblings, 0 replies; 7+ messages in thread From: Jeff King @ 2015-12-16 21:52 UTC (permalink / raw) To: Junio C Hamano; +Cc: Patrick Steinhardt, git On Wed, Dec 16, 2015 at 12:29:38PM -0800, Junio C Hamano wrote: > Jeff King <peff@peff.net> writes: > > > At this point, it seems that "--delete" is useful, and nothing else has > > been proposed for "-d" in the intervening years. It seems like a > > reasonable use of the flag to me. > > I think there were two (and a half) reasons why we didn't let > "--delete" use a short-and-sweet "-d", and I agree that "something > else that is more useful did not come" removes one of them. > > The other reason was to avoid the chance of fat-fingering, because > deleting is destructive, and it is even harder to recover from if > the damage is done remotely (and the remaining one-half is that > deleting is a rare event). > > Even though I do not think the need for the "safety" has been > reduced over time to warrant this change, a similarity with "branch" > that has "-d/--delete" would be a good enough argument to support > this change. Thanks for the input, I hadn't considered "safety" at all. We do have safety measures on "git branch -d" that we don't have here. I guess we could implement something similar (e.g., see if the to-be-deleted branch is merged elsewhere; of course we might not have the objects locally at all). On the other hand, you can already screw yourself pretty badly with "push -f". So I think it's probably OK to add "-d". -Peff ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-12-16 21:53 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-12-14 15:23 [PATCH 1/2] push: add '--delete' flag to synopsis Patrick Steinhardt 2015-12-14 15:23 ` [PATCH 2/2] push: add '-d' as shorthand for '--delete' Patrick Steinhardt 2015-12-14 19:18 ` Junio C Hamano 2015-12-15 9:22 ` Patrick Steinhardt 2015-12-14 21:18 ` Jeff King 2015-12-16 20:29 ` Junio C Hamano 2015-12-16 21:52 ` Jeff King
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).