RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    [SOLVED] How To Get RetroPie Commit Date

    Scheduled Pinned Locked Moved Help and Support
    retropiegitbash
    8 Posts 3 Posters 2.4k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • obsidianspiderO
      obsidianspider
      last edited by obsidianspider

      How can I get the "Last Commit" value on my system like on the RetroPie-Setup screen?

      0_1473445284830_retropie-version.png

      I found the RetroPie version number in opt/retropie/VERSION but I'm trying to reverse engineer the RetroPie-Setup script to figure out how it's getting commit date and I'm obviously missing something.

      I can see where the setup screen is outputting the commit variable

      and I can see where the commit variable is being defined

      but when I try to get the date using a simple bash script I'm getting something different than what shows up on my setup screen.

      commit=$(git log -1 --pretty=format:"%cr (%h)")
      echo "Last Commit: $commit"
      

      Last Commit: 4 months ago (d7f5016)

      I'm assuming it's because I need to tell the git command to pull from a different file/directory? I don't know enough about git or RetroPie to know where that should be.

      📷 @obsidianspider

      meleuM 2 Replies Last reply Reply Quote 0
      • meleuM
        meleu @obsidianspider
        last edited by

        @obsidianspider
        Did you try to execute?:

        git log -1 --pretty=format:"%cr (%h)"
        

        ;-)

        • Useful topics
        • joystick-selection tool
        • rpie-art tool
        • achievements I made
        obsidianspiderO 1 Reply Last reply Reply Quote 1
        • obsidianspiderO
          obsidianspider @meleu
          last edited by

          @meleu said in How To Get RetroPie Commit Date:

          @obsidianspider
          Did you try to execute?:

          git log -1 --pretty=format:"%cr (%h)"
          

          ;-)

          Yes ;-)

          $ git log -1 --pretty=format:"%cr (%h)"
          4 months ago (d7f5016)
          

          It seems to be pulling a date from something different than what the RetroPie setup screen is using.

          📷 @obsidianspider

          1 Reply Last reply Reply Quote 0
          • meleuM
            meleu @obsidianspider
            last edited by

            @obsidianspider
            I looked here: https://git-scm.com/docs/pretty-formats
            And I think you can get what you want with this command:

            git log -1 --pretty=format:"%cD"
            

            Description of some formats that might interest you:

            '%cd': committer date (format respects --date= option)
            
            '%cD': committer date, RFC2822 style
            
            '%cr': committer date, relative
            
            '%ct': committer date, UNIX timestamp
            
            '%ci': committer date, ISO 8601-like format
            
            '%cI': committer date, strict ISO 8601 format
            

            Hope it helps.

            • Useful topics
            • joystick-selection tool
            • rpie-art tool
            • achievements I made
            obsidianspiderO 1 Reply Last reply Reply Quote 1
            • obsidianspiderO
              obsidianspider @meleu
              last edited by

              @meleu I think the problem is that I need to know what to run the git command against.

              📷 @obsidianspider

              1 Reply Last reply Reply Quote 0
              • BuZzB
                BuZz administrators
                last edited by BuZz

                It does it on the current git repository you are in - so what is your current directory ?

                To help us help you - please make sure you read the sticky topics before posting - https://retropie.org.uk/forum/topic/3/read-this-first

                obsidianspiderO 1 Reply Last reply Reply Quote 1
                • obsidianspiderO
                  obsidianspider
                  last edited by

                  I got it!

                  I had to use the --git-dir parameter to tell git where to point and it looks like /home/pi/RetroPie-Setup/.git is the right location (it matches what's in the RetroPie-Setup screen)

                  commit=$(git --git-dir /home/pi/RetroPie-Setup/.git log -1 --pretty=format:"%cr (%h)")
                  echo "Last Commit: $commit"
                  
                  $ ./version.sh
                  Last Commit: 11 days ago (a60c9b3)
                  

                  📷 @obsidianspider

                  1 Reply Last reply Reply Quote 1
                  • obsidianspiderO
                    obsidianspider @BuZz
                    last edited by

                    @BuZz git is something I know very little about, but I think I figured out how to get the versioning. Thanks :)

                    📷 @obsidianspider

                    1 Reply Last reply Reply Quote 1
                    • First post
                      Last post

                    Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                    Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.