How can I get the name of the last person who pushed to a remote?












2















I know that the option -force-with-lease allows me to push force only if I was last committer but I would like to allow overriding it:



git push playground $current_branch:master --force-with-lease

if ! [[ "$?" == "0" ]]; then
last_committer="$(git some command)"
ask_continue "the last committer was $last_committer, would you like to push force?"
git push playground $current_branch:master --force
fi


In that example, I would like to know what git some command would be.










share|improve this question




















  • 1





    Your plan is dangerous! if --force-with-lease fails you should always check the remote history and merge the remote state of the branch into yours or rebase onto it. pushing with --force in that situation will remove the other contributors changes from the history.

    – Timothy Truckle
    yesterday








  • 1





    I want to remove the other contributors change, it is a playground environment where anyone can, well, play! Nonetheless, thank you for pointing that out for any user coming here. Don't do this if you are not aware of it.

    – Ulysse BN
    yesterday
















2















I know that the option -force-with-lease allows me to push force only if I was last committer but I would like to allow overriding it:



git push playground $current_branch:master --force-with-lease

if ! [[ "$?" == "0" ]]; then
last_committer="$(git some command)"
ask_continue "the last committer was $last_committer, would you like to push force?"
git push playground $current_branch:master --force
fi


In that example, I would like to know what git some command would be.










share|improve this question




















  • 1





    Your plan is dangerous! if --force-with-lease fails you should always check the remote history and merge the remote state of the branch into yours or rebase onto it. pushing with --force in that situation will remove the other contributors changes from the history.

    – Timothy Truckle
    yesterday








  • 1





    I want to remove the other contributors change, it is a playground environment where anyone can, well, play! Nonetheless, thank you for pointing that out for any user coming here. Don't do this if you are not aware of it.

    – Ulysse BN
    yesterday














2












2








2








I know that the option -force-with-lease allows me to push force only if I was last committer but I would like to allow overriding it:



git push playground $current_branch:master --force-with-lease

if ! [[ "$?" == "0" ]]; then
last_committer="$(git some command)"
ask_continue "the last committer was $last_committer, would you like to push force?"
git push playground $current_branch:master --force
fi


In that example, I would like to know what git some command would be.










share|improve this question
















I know that the option -force-with-lease allows me to push force only if I was last committer but I would like to allow overriding it:



git push playground $current_branch:master --force-with-lease

if ! [[ "$?" == "0" ]]; then
last_committer="$(git some command)"
ask_continue "the last committer was $last_committer, would you like to push force?"
git push playground $current_branch:master --force
fi


In that example, I would like to know what git some command would be.







bash git






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited yesterday







Ulysse BN

















asked yesterday









Ulysse BNUlysse BN

2,30111231




2,30111231








  • 1





    Your plan is dangerous! if --force-with-lease fails you should always check the remote history and merge the remote state of the branch into yours or rebase onto it. pushing with --force in that situation will remove the other contributors changes from the history.

    – Timothy Truckle
    yesterday








  • 1





    I want to remove the other contributors change, it is a playground environment where anyone can, well, play! Nonetheless, thank you for pointing that out for any user coming here. Don't do this if you are not aware of it.

    – Ulysse BN
    yesterday














  • 1





    Your plan is dangerous! if --force-with-lease fails you should always check the remote history and merge the remote state of the branch into yours or rebase onto it. pushing with --force in that situation will remove the other contributors changes from the history.

    – Timothy Truckle
    yesterday








  • 1





    I want to remove the other contributors change, it is a playground environment where anyone can, well, play! Nonetheless, thank you for pointing that out for any user coming here. Don't do this if you are not aware of it.

    – Ulysse BN
    yesterday








1




1





Your plan is dangerous! if --force-with-lease fails you should always check the remote history and merge the remote state of the branch into yours or rebase onto it. pushing with --force in that situation will remove the other contributors changes from the history.

– Timothy Truckle
yesterday







Your plan is dangerous! if --force-with-lease fails you should always check the remote history and merge the remote state of the branch into yours or rebase onto it. pushing with --force in that situation will remove the other contributors changes from the history.

– Timothy Truckle
yesterday






1




1





I want to remove the other contributors change, it is a playground environment where anyone can, well, play! Nonetheless, thank you for pointing that out for any user coming here. Don't do this if you are not aware of it.

– Ulysse BN
yesterday





I want to remove the other contributors change, it is a playground environment where anyone can, well, play! Nonetheless, thank you for pointing that out for any user coming here. Don't do this if you are not aware of it.

– Ulysse BN
yesterday












2 Answers
2






active

oldest

votes


















1














git show --quiet --pretty=format:%an



--quiet - suppresses the diff output



%an - is the author name (For all other formats click this)




If you want to look who made last commit on a specific branch




git show --quiet --pretty=format:%an origin/branch-name






share|improve this answer
























  • So in my case git show --quiet --pretty=format:%an playground/master. Thank you very much.

    – Ulysse BN
    yesterday



















0














In order get the last commit details for author-name, date and time is



git log -1



Here you can find more detail for getting commit history.
https://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History



hope this will help you.






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',
    autoActivateHeartbeat: false,
    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%2f54250839%2fhow-can-i-get-the-name-of-the-last-person-who-pushed-to-a-remote%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    git show --quiet --pretty=format:%an



    --quiet - suppresses the diff output



    %an - is the author name (For all other formats click this)




    If you want to look who made last commit on a specific branch




    git show --quiet --pretty=format:%an origin/branch-name






    share|improve this answer
























    • So in my case git show --quiet --pretty=format:%an playground/master. Thank you very much.

      – Ulysse BN
      yesterday
















    1














    git show --quiet --pretty=format:%an



    --quiet - suppresses the diff output



    %an - is the author name (For all other formats click this)




    If you want to look who made last commit on a specific branch




    git show --quiet --pretty=format:%an origin/branch-name






    share|improve this answer
























    • So in my case git show --quiet --pretty=format:%an playground/master. Thank you very much.

      – Ulysse BN
      yesterday














    1












    1








    1







    git show --quiet --pretty=format:%an



    --quiet - suppresses the diff output



    %an - is the author name (For all other formats click this)




    If you want to look who made last commit on a specific branch




    git show --quiet --pretty=format:%an origin/branch-name






    share|improve this answer













    git show --quiet --pretty=format:%an



    --quiet - suppresses the diff output



    %an - is the author name (For all other formats click this)




    If you want to look who made last commit on a specific branch




    git show --quiet --pretty=format:%an origin/branch-name







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered yesterday









    Praveen RajPraveen Raj

    665




    665













    • So in my case git show --quiet --pretty=format:%an playground/master. Thank you very much.

      – Ulysse BN
      yesterday



















    • So in my case git show --quiet --pretty=format:%an playground/master. Thank you very much.

      – Ulysse BN
      yesterday

















    So in my case git show --quiet --pretty=format:%an playground/master. Thank you very much.

    – Ulysse BN
    yesterday





    So in my case git show --quiet --pretty=format:%an playground/master. Thank you very much.

    – Ulysse BN
    yesterday













    0














    In order get the last commit details for author-name, date and time is



    git log -1



    Here you can find more detail for getting commit history.
    https://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History



    hope this will help you.






    share|improve this answer




























      0














      In order get the last commit details for author-name, date and time is



      git log -1



      Here you can find more detail for getting commit history.
      https://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History



      hope this will help you.






      share|improve this answer


























        0












        0








        0







        In order get the last commit details for author-name, date and time is



        git log -1



        Here you can find more detail for getting commit history.
        https://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History



        hope this will help you.






        share|improve this answer













        In order get the last commit details for author-name, date and time is



        git log -1



        Here you can find more detail for getting commit history.
        https://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History



        hope this will help you.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered yesterday









        Usama KiyaniUsama Kiyani

        154




        154






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54250839%2fhow-can-i-get-the-name-of-the-last-person-who-pushed-to-a-remote%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

            Liquibase includeAll doesn't find base path

            How to use setInterval in EJS file?

            Petrus Granier-Deferre