How to capture the tags applied by git decorate











up vote
2
down vote

favorite












What goes on here? Why are the two outputs different?



$ git log --oneline -n1
7dbee6d (HEAD -> master, origin/master, origin/HEAD) some commit msg

$ git log --oneline -n1 | head
7dbee6d some commit msg


The piping to 'head' was the simplest example I could find to illustrate the problem. The problem prevents me from e.g.:




  • Piping to a file including the git decoration

  • Piping to "grep", e.g. to grep for certain tags


system:




  • Ubuntu 18.04.1 LTS

  • git version 2.17.1

  • GNU bash, version 4.4.19(1)-release (x86_64-pc-linux-gnu)










share|improve this question




















  • 1




    Both commands give the same output at my end.
    – Mayank Porwal
    Nov 9 at 7:17










  • Which operating system, shell and git version?
    – Jan Hudec
    Nov 9 at 7:43










  • @user3729611 What is the | head part meant to achieve here?
    – RomainValeri
    Nov 9 at 9:37

















up vote
2
down vote

favorite












What goes on here? Why are the two outputs different?



$ git log --oneline -n1
7dbee6d (HEAD -> master, origin/master, origin/HEAD) some commit msg

$ git log --oneline -n1 | head
7dbee6d some commit msg


The piping to 'head' was the simplest example I could find to illustrate the problem. The problem prevents me from e.g.:




  • Piping to a file including the git decoration

  • Piping to "grep", e.g. to grep for certain tags


system:




  • Ubuntu 18.04.1 LTS

  • git version 2.17.1

  • GNU bash, version 4.4.19(1)-release (x86_64-pc-linux-gnu)










share|improve this question




















  • 1




    Both commands give the same output at my end.
    – Mayank Porwal
    Nov 9 at 7:17










  • Which operating system, shell and git version?
    – Jan Hudec
    Nov 9 at 7:43










  • @user3729611 What is the | head part meant to achieve here?
    – RomainValeri
    Nov 9 at 9:37















up vote
2
down vote

favorite









up vote
2
down vote

favorite











What goes on here? Why are the two outputs different?



$ git log --oneline -n1
7dbee6d (HEAD -> master, origin/master, origin/HEAD) some commit msg

$ git log --oneline -n1 | head
7dbee6d some commit msg


The piping to 'head' was the simplest example I could find to illustrate the problem. The problem prevents me from e.g.:




  • Piping to a file including the git decoration

  • Piping to "grep", e.g. to grep for certain tags


system:




  • Ubuntu 18.04.1 LTS

  • git version 2.17.1

  • GNU bash, version 4.4.19(1)-release (x86_64-pc-linux-gnu)










share|improve this question















What goes on here? Why are the two outputs different?



$ git log --oneline -n1
7dbee6d (HEAD -> master, origin/master, origin/HEAD) some commit msg

$ git log --oneline -n1 | head
7dbee6d some commit msg


The piping to 'head' was the simplest example I could find to illustrate the problem. The problem prevents me from e.g.:




  • Piping to a file including the git decoration

  • Piping to "grep", e.g. to grep for certain tags


system:




  • Ubuntu 18.04.1 LTS

  • git version 2.17.1

  • GNU bash, version 4.4.19(1)-release (x86_64-pc-linux-gnu)







git shell stdout






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 9 at 10:25

























asked Nov 9 at 7:12









user3729611

655




655








  • 1




    Both commands give the same output at my end.
    – Mayank Porwal
    Nov 9 at 7:17










  • Which operating system, shell and git version?
    – Jan Hudec
    Nov 9 at 7:43










  • @user3729611 What is the | head part meant to achieve here?
    – RomainValeri
    Nov 9 at 9:37
















  • 1




    Both commands give the same output at my end.
    – Mayank Porwal
    Nov 9 at 7:17










  • Which operating system, shell and git version?
    – Jan Hudec
    Nov 9 at 7:43










  • @user3729611 What is the | head part meant to achieve here?
    – RomainValeri
    Nov 9 at 9:37










1




1




Both commands give the same output at my end.
– Mayank Porwal
Nov 9 at 7:17




Both commands give the same output at my end.
– Mayank Porwal
Nov 9 at 7:17












Which operating system, shell and git version?
– Jan Hudec
Nov 9 at 7:43




Which operating system, shell and git version?
– Jan Hudec
Nov 9 at 7:43












@user3729611 What is the | head part meant to achieve here?
– RomainValeri
Nov 9 at 9:37






@user3729611 What is the | head part meant to achieve here?
– RomainValeri
Nov 9 at 9:37














1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










From the log manpage:




--decorate[=short|full|auto|no]

Print out the ref names of any commits that are shown. If short is
specified, the ref name prefixes refs/heads/, refs/tags/ and
refs/remotes/ will not be printed. If full is specified, the full
ref name (including prefix) will be printed. If auto is specified,
then if the output is going to a terminal, the ref names are shown
as if short were given, otherwise no ref names are shown.
The default option is short.



So when called with --decorate=auto, the behavior will change depending whether stdout is a terminal or not. If you pipe git log output somewhere, stdout will not be a terminal.



The default is short, but you may have auto somewhere in your git options.



To get the same behavior in both cases, call it with --decorate=short






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53221274%2fhow-to-capture-the-tags-applied-by-git-decorate%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote



    accepted










    From the log manpage:




    --decorate[=short|full|auto|no]

    Print out the ref names of any commits that are shown. If short is
    specified, the ref name prefixes refs/heads/, refs/tags/ and
    refs/remotes/ will not be printed. If full is specified, the full
    ref name (including prefix) will be printed. If auto is specified,
    then if the output is going to a terminal, the ref names are shown
    as if short were given, otherwise no ref names are shown.
    The default option is short.



    So when called with --decorate=auto, the behavior will change depending whether stdout is a terminal or not. If you pipe git log output somewhere, stdout will not be a terminal.



    The default is short, but you may have auto somewhere in your git options.



    To get the same behavior in both cases, call it with --decorate=short






    share|improve this answer



























      up vote
      1
      down vote



      accepted










      From the log manpage:




      --decorate[=short|full|auto|no]

      Print out the ref names of any commits that are shown. If short is
      specified, the ref name prefixes refs/heads/, refs/tags/ and
      refs/remotes/ will not be printed. If full is specified, the full
      ref name (including prefix) will be printed. If auto is specified,
      then if the output is going to a terminal, the ref names are shown
      as if short were given, otherwise no ref names are shown.
      The default option is short.



      So when called with --decorate=auto, the behavior will change depending whether stdout is a terminal or not. If you pipe git log output somewhere, stdout will not be a terminal.



      The default is short, but you may have auto somewhere in your git options.



      To get the same behavior in both cases, call it with --decorate=short






      share|improve this answer

























        up vote
        1
        down vote



        accepted







        up vote
        1
        down vote



        accepted






        From the log manpage:




        --decorate[=short|full|auto|no]

        Print out the ref names of any commits that are shown. If short is
        specified, the ref name prefixes refs/heads/, refs/tags/ and
        refs/remotes/ will not be printed. If full is specified, the full
        ref name (including prefix) will be printed. If auto is specified,
        then if the output is going to a terminal, the ref names are shown
        as if short were given, otherwise no ref names are shown.
        The default option is short.



        So when called with --decorate=auto, the behavior will change depending whether stdout is a terminal or not. If you pipe git log output somewhere, stdout will not be a terminal.



        The default is short, but you may have auto somewhere in your git options.



        To get the same behavior in both cases, call it with --decorate=short






        share|improve this answer














        From the log manpage:




        --decorate[=short|full|auto|no]

        Print out the ref names of any commits that are shown. If short is
        specified, the ref name prefixes refs/heads/, refs/tags/ and
        refs/remotes/ will not be printed. If full is specified, the full
        ref name (including prefix) will be printed. If auto is specified,
        then if the output is going to a terminal, the ref names are shown
        as if short were given, otherwise no ref names are shown.
        The default option is short.



        So when called with --decorate=auto, the behavior will change depending whether stdout is a terminal or not. If you pipe git log output somewhere, stdout will not be a terminal.



        The default is short, but you may have auto somewhere in your git options.



        To get the same behavior in both cases, call it with --decorate=short







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 9 at 10:44

























        answered Nov 9 at 10:39









        ohlec

        1,685717




        1,685717






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53221274%2fhow-to-capture-the-tags-applied-by-git-decorate%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Schultheiß

            Liste der Kulturdenkmale in Wilsdruff

            Android Play Services Check