{"thread":{"id":"33710","subject":"Another use of \"@\"?","startedAt":"2013-05-03T02:51:18Z","lastAt":"2013-05-04T21:11:44Z","messageCount":11,"participants":["Duy Nguyen","Junio C Hamano","Felipe Contreras","Thomas Rast","Matthieu Moy","Ramkumar Ramachandra"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"216321","messageId":"CACsJy8AcWV8hmbhG27dw+GdnZf8NnQEctYmowqd3sSzOOHf+xg@mail.gmail.com","threadId":"33710","inReplyTo":null,"subject":"Another use of \"@\"?","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2013-05-03T02:51:18Z","receivedAt":"2013-05-03T02:51:18Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Hi,\n\nMy setup is a bit peculiar where I do git development on three\ndifferent machines. Say I updated branch long-branch-name on machine\nA. Then I continue my work on machine B. I would want to hard reset\nthat long-branch-name on machine B before resuming my work. What I\nusually do is\n\ngit co long-branch-name\ngit diff A/long-branch-name\ngit reset --hard A/long-branch-name\n\nbut typing long-branch-name (even with TAB completion) is not fun.\nCould I do this (or something similar) instead?\n\ngit co long-branch-name\ngit diff A/@\ngit reset --hard A/@\n--\nDuy\n"},{"id":"216336","messageId":"7vr4hozie1.fsf@alter.siamese.dyndns.org","threadId":"33710","inReplyTo":"CACsJy8AcWV8hmbhG27dw+GdnZf8NnQEctYmowqd3sSzOOHf+xg@mail.gmail.com","subject":"Re: Another use of \"@\"?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-05-03T06:28:54Z","receivedAt":"2013-05-03T06:28:54Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Duy Nguyen <pclouds@gmail.com> writes:\n\n> My setup is a bit peculiar where I do git development on three\n> different machines. Say I updated branch long-branch-name on machine\n> A. Then I continue my work on machine B. I would want to hard reset\n> that long-branch-name on machine B before resuming my work. What I\n> usually do is\n>\n> git co long-branch-name\n> git diff A/long-branch-name\n> git reset --hard A/long-branch-name\n\nPerhaps\n\n    git checkout long-bra<TAB>\n    git diff A/!$\n    git reset --hard !$\n\nIn any case, not a Git question, I would have to say.\n"},{"id":"216338","messageId":"7vfvy4zhy5.fsf@alter.siamese.dyndns.org","threadId":"33710","inReplyTo":"7vr4hozie1.fsf@alter.siamese.dyndns.org","subject":"Re: Another use of \"@\"?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-05-03T06:38:26Z","receivedAt":"2013-05-03T06:38:26Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Duy Nguyen <pclouds@gmail.com> writes:\n>\n>> My setup is a bit peculiar where I do git development on three\n>> different machines. Say I updated branch long-branch-name on machine\n>> A. Then I continue my work on machine B. I would want to hard reset\n>> that long-branch-name on machine B before resuming my work. What I\n>> usually do is\n>>\n>> git co long-branch-name\n>> git diff A/long-branch-name\n>> git reset --hard A/long-branch-name\n>\n> Perhaps\n>\n>     git checkout long-bra<TAB>\n>     git diff A/!$\n>     git reset --hard !$\n>\n> In any case, not a Git question, I would have to say.\n\nAs a Git question, probably the answers are\n\n\tgit co long-bra<TAB>\n        git diff @{u}\n        git reset --hard @{u}\n\nwith an appropriate setting of the upstream, perhaps?\n"},{"id":"216339","messageId":"CAMP44s3pN22yfvs_PTzGFfp2cxm3gFMU0ofZ0bNBnzB_yfo+6Q@mail.gmail.com","threadId":"33710","inReplyTo":"CACsJy8AcWV8hmbhG27dw+GdnZf8NnQEctYmowqd3sSzOOHf+xg@mail.gmail.com","subject":"Re: Another use of \"@\"?","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-03T06:39:24Z","receivedAt":"2013-05-03T06:39:24Z","isPatch":false,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Thu, May 2, 2013 at 9:51 PM, Duy Nguyen <pclouds@gmail.com> wrote:\n> Hi,\n>\n> My setup is a bit peculiar where I do git development on three\n> different machines. Say I updated branch long-branch-name on machine\n> A. Then I continue my work on machine B. I would want to hard reset\n> that long-branch-name on machine B before resuming my work. What I\n> usually do is\n>\n> git co long-branch-name\n> git diff A/long-branch-name\n> git reset --hard A/long-branch-name\n>\n> but typing long-branch-name (even with TAB completion) is not fun.\n> Could I do this (or something similar) instead?\n>\n> git co long-branch-name\n> git diff A/@\n> git reset --hard A/@\n\nMaybe this would make more sense:\n\n%git co long-branch-name\n%git reset --keep A/long-branch-name\n\nIf you have changes but they don't conflict, they will be carried\nover, and it they do conflict, the reset won't continue. I think in\nmost cases there will be no conflict, so the times you need to do 'git\ndiff' will be rather small.\n\nYes, many times I would like an idiom that would just replace\nsomething with the current branch, like your A/@, but I don't know\nwhere the right place for that would be.\n\nAlso, I feel we are missing some kind of branch, like a\nremote-specific upstream, so instead of 'git reset A/foo' you would do\n'git reset A@{u}'. By default the remote-specific upstream would be\nthe same name of the branch, but it could be configured.\n\nMoreover, we should probably have common aliases distributed (e.g. git co).\n\n-- \nFelipe Contreras\n"},{"id":"216341","messageId":"CACsJy8Btz6=4ZUjW3OR2v-LDaDcDaiK=7ucf8rO8MsG9cXt++g@mail.gmail.com","threadId":"33710","inReplyTo":"7vfvy4zhy5.fsf@alter.siamese.dyndns.org","subject":"Re: Another use of \"@\"?","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2013-05-03T06:51:21Z","receivedAt":"2013-05-03T06:51:21Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Fri, May 3, 2013 at 4:38 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> Duy Nguyen <pclouds@gmail.com> writes:\n>>\n>>> My setup is a bit peculiar where I do git development on three\n>>> different machines. Say I updated branch long-branch-name on machine\n>>> A. Then I continue my work on machine B. I would want to hard reset\n>>> that long-branch-name on machine B before resuming my work. What I\n>>> usually do is\n>>>\n>>> git co long-branch-name\n>>> git diff A/long-branch-name\n>>> git reset --hard A/long-branch-name\n>>\n>> Perhaps\n>>\n>>     git checkout long-bra<TAB>\n>>     git diff A/!$\n>>     git reset --hard !$\n\n\"diff\" does not have to follow \"checkout\".\n\n>> In any case, not a Git question, I would have to say.\n>\n> As a Git question, probably the answers are\n>\n>         git co long-bra<TAB>\n>         git diff @{u}\n>         git reset --hard @{u}\n>\n> with an appropriate setting of the upstream, perhaps?\n\nand @{u} can't be used because I might want to resume from machine C\ninstead of A. I don't have a single upstream.\n--\nDuy\n"},{"id":"216347","messageId":"8738u4pgbe.fsf@linux-k42r.v.cablecom.net","threadId":"33710","inReplyTo":"CACsJy8Btz6=4ZUjW3OR2v-LDaDcDaiK=7ucf8rO8MsG9cXt++g@mail.gmail.com","subject":"Re: Another use of \"@\"?","fromName":"Thomas Rast","fromEmail":"trast@inf.ethz.ch","sentAt":"2013-05-03T09:23:49Z","receivedAt":"2013-05-03T09:23:49Z","isPatch":false,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Duy Nguyen <pclouds@gmail.com> writes:\n\n> On Fri, May 3, 2013 at 4:38 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Junio C Hamano <gitster@pobox.com> writes:\n>>\n>>> Duy Nguyen <pclouds@gmail.com> writes:\n>>>\n>>>> My setup is a bit peculiar where I do git development on three\n>>>> different machines. Say I updated branch long-branch-name on machine\n>>>> A. Then I continue my work on machine B. I would want to hard reset\n>>>> that long-branch-name on machine B before resuming my work. What I\n>>>> usually do is\n>>>>\n>>>> git co long-branch-name\n>>>> git diff A/long-branch-name\n>>>> git reset --hard A/long-branch-name\n>>>\n>>> Perhaps\n>>>\n>>>     git checkout long-bra<TAB>\n>>>     git diff A/!$\n>>>     git reset --hard !$\n>\n> \"diff\" does not have to follow \"checkout\".\n\nAt least in bash with readline, you can also use M-. to cycle through\nthe last arguments of the previous commands.\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"},{"id":"216375","messageId":"vpqy5bvaf6x.fsf@grenoble-inp.fr","threadId":"33710","inReplyTo":"7vr4hozie1.fsf@alter.siamese.dyndns.org","subject":"Re: Another use of \"@\"?","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2013-05-03T22:09:26Z","receivedAt":"2013-05-03T22:09:26Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Duy Nguyen <pclouds@gmail.com> writes:\n>\n>> My setup is a bit peculiar where I do git development on three\n>> different machines. Say I updated branch long-branch-name on machine\n>> A. Then I continue my work on machine B. I would want to hard reset\n>> that long-branch-name on machine B before resuming my work. What I\n>> usually do is\n>>\n>> git co long-branch-name\n>> git diff A/long-branch-name\n>> git reset --hard A/long-branch-name\n>\n> Perhaps\n>\n>     git checkout long-bra<TAB>\n>     git diff A/!$\n>     git reset --hard !$\n\nI think Duy meant\n\n  git diff A/$(git symbolic-ref --short HEAD)\n\ni.e. \"the branch with the same name as the current one, but on a\ndifferent remote\". If this is the question, then it is a Git thing more\nthan a shell one.\n\nThe A/@ could make sense, but I'm wondering whether we're taking the\ndirection of implementing some kind of Brainfuck dialect in Git revision\nspecifiers. I'm not sure we want to add more special characters here and\nthere with subtly different meanings (@ = HEAD, @{1} = HEAD@{1}, A/@ =\nA/$(git symbolic-ref --short HEAD)).\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"216399","messageId":"CACsJy8DsrY9ybLoCAo35Puc7oR41Kda9nKjBXL147qN-3xrMRA@mail.gmail.com","threadId":"33710","inReplyTo":"vpqy5bvaf6x.fsf@grenoble-inp.fr","subject":"Re: Another use of \"@\"?","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2013-05-04T03:26:08Z","receivedAt":"2013-05-04T03:26:08Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sat, May 4, 2013 at 5:09 AM, Matthieu Moy\n<Matthieu.Moy@grenoble-inp.fr> wrote:\n> The A/@ could make sense, but I'm wondering whether we're taking the\n> direction of implementing some kind of Brainfuck dialect in Git revision\n> specifiers. I'm not sure we want to add more special characters here and\n> there with subtly different meanings (@ = HEAD, @{1} = HEAD@{1}, A/@ =\n> A/$(git symbolic-ref --short HEAD)).\n\nAnother subtle overloading of @ that might be desirable (althought\nmight be achievable another way). \"git log -g\"  is equal to \"git log\n-g HEAD\" but there is no easy way (that I know of) to do \"git log -g\n$(git symbolic-ref HEAD)\". \"@\" could fill the inconvenient spot here,\nI think. Alias is no good because I won't be able to add extra\noptions.\n--\nDuy\n"},{"id":"216401","messageId":"CACsJy8DkDes5SdvU7W1kg24w3VBaQz9caZnkyy6iWFiYqw6Saw@mail.gmail.com","threadId":"33710","inReplyTo":"CACsJy8DsrY9ybLoCAo35Puc7oR41Kda9nKjBXL147qN-3xrMRA@mail.gmail.com","subject":"Re: Another use of \"@\"?","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2013-05-04T03:48:23Z","receivedAt":"2013-05-04T03:48:23Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sat, May 4, 2013 at 10:26 AM, Duy Nguyen <pclouds@gmail.com> wrote:\n> On Sat, May 4, 2013 at 5:09 AM, Matthieu Moy\n> <Matthieu.Moy@grenoble-inp.fr> wrote:\n>> The A/@ could make sense, but I'm wondering whether we're taking the\n>> direction of implementing some kind of Brainfuck dialect in Git revision\n>> specifiers. I'm not sure we want to add more special characters here and\n>> there with subtly different meanings (@ = HEAD, @{1} = HEAD@{1}, A/@ =\n>> A/$(git symbolic-ref --short HEAD)).\n>\n> Another subtle overloading of @ that might be desirable (althought\n> might be achievable another way). \"git log -g\"  is equal to \"git log\n> -g HEAD\" but there is no easy way (that I know of) to do \"git log -g\n> $(git symbolic-ref HEAD)\". \"@\" could fill the inconvenient spot here,\n> I think. Alias is no good because I won't be able to add extra\n> options.\n\nI wouldn't mind typing <ref>@{link} that does \"git symbolic-ref\n<ref>\", though. Because ref is optional, \"git log -g @{link}\" is not\nbad. \"link\" is probably not a good name for this.\n--\nDuy\n"},{"id":"216413","messageId":"CALkWK0=qdGcbQDz2VomhOcy7AybXj5jkxzS53jFGyjdZ9+6juQ@mail.gmail.com","threadId":"33710","inReplyTo":"CACsJy8AcWV8hmbhG27dw+GdnZf8NnQEctYmowqd3sSzOOHf+xg@mail.gmail.com","subject":"Re: Another use of \"@\"?","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-05-04T12:44:07Z","receivedAt":"2013-05-04T12:44:07Z","isPatch":false,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"[joining the discussion late; was travelling]\n\nDuy Nguyen wrote:\n> git co long-branch-name\n> git diff A/@\n> git reset --hard A/@\n\nIn this form, this looks highly inconsistent.  You have to decide if\nyou want @ to resolve to the current branch name or HEAD.  Our current\n@-proposal makes @@{1} display the reflog for HEAD for instance.  The\nother problem is that we resolve things like @{-1} to full refs like\nrefs/heads/master.  Making a A/@{-1} work makes little or no sense,\nbecause that refs/heads needs to be changed to refs/remotes in the\nfirst place.  What about refs/decapitated/@{-1}?  Should we support\nit?\n\nI tend to agree with Junio here: @{u} is the way forward.  We need to\ndefine useful reduced consistent semantics; while inventing a\nmini-language to do all kinds of revision manipulations may be a fun\ntheoretical exercise, it's too much effort for too little gain.  We\nhave to learn to work within the limitations of what we've invented so\nfar.\n\nOn Matthieu's note, I have a comment: symbolic refs are an absolute\ndead end.  We didn't think of it from the start, and it's too late\nnow.  Do NOT go there: from my investigation, I believe that hooking\nup everything to the revision parser is the way forward.\n"},{"id":"216425","messageId":"vpqtxmi8n73.fsf@grenoble-inp.fr","threadId":"33710","inReplyTo":"CALkWK0=qdGcbQDz2VomhOcy7AybXj5jkxzS53jFGyjdZ9+6juQ@mail.gmail.com","subject":"Re: Another use of \"@\"?","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2013-05-04T21:11:44Z","receivedAt":"2013-05-04T21:11:44Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Ramkumar Ramachandra <artagnon@gmail.com> writes:\n\n> On Matthieu's note, I have a comment: symbolic refs are an absolute\n> dead end.  We didn't think of it from the start, and it's too late\n> now.  Do NOT go there: from my investigation, I believe that hooking\n> up everything to the revision parser is the way forward.\n\nMy comment was not about the solution, but about the problem (which\nseemed to have been misunderstood). The question seems to be \"get the\nreference with the same names as what HEAD points to, but on remote A\",\nand the \"points to\" part is about symbolic references.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"}]}