Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. To get Git commit information
Forum Updated to NodeBB v4.3 + New Features

To get Git commit information

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 296 Views 1 Watching
  • 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.
  • R Offline
    R Offline
    russjohn834
    wrote on last edited by
    #1

    Hi All,

    I want to add my Git commit information as a text with my "About software" section.
    Is there an easy way to get this information in Qt?

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      Are you using qmake or CMake?

      The general idea is to have the makefile generator run git log -1 --pretty=%B (or whatever other git command) during the config step and save the output to a header file that you can include

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      R 1 Reply Last reply
      4
      • VRoninV VRonin

        Are you using qmake or CMake?

        The general idea is to have the makefile generator run git log -1 --pretty=%B (or whatever other git command) during the config step and save the output to a header file that you can include

        R Offline
        R Offline
        russjohn834
        wrote on last edited by
        #3

        @VRonin Thank you. I'm using qmake.

        @VRonin said in To get Git commit information:

        The general idea is to have the makefile generator run git log -1 --pretty=%B (or whatever other git command) during the config step and save the output to a header file that you can include

        Can you show me an example?

        1 Reply Last reply
        0
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #4

          something like:

          beforebuild.commands = git log -1 --pretty=%B > commitmessage.h
          QMAKE_EXTRA_TARGETS += beforebuild
          

          of course you'll need to format the output better and use depends on your main program to make sure this target is run first

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          1 Reply Last reply
          4

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved