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. What should be in .gitignore?
QtWS25 Last Chance

What should be in .gitignore?

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 4 Posters 3.1k Views
  • 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.
  • I Offline
    I Offline
    idlefrog
    wrote on 26 Oct 2021, 10:18 last edited by
    #1

    Is there an official template for .gitignore ?

    I've only found this: Using Git

    J J 2 Replies Last reply 26 Oct 2021, 10:38
    0
    • I idlefrog
      26 Oct 2021, 11:05

      Thanks @J-Hilk
      In the end I just went with:

      *.pro.user*
      

      I'll just add to it as I go!

      J Online
      J Online
      JonB
      wrote on 26 Oct 2021, 11:16 last edited by JonB
      #5

      @idlefrog
      :) For reference, I paste my own .gitignore (Linux development) below. It's somewhat larger than yours ;-) Taken from a template somewhere. Only the last segment, under AtH [I should probably have added release/ too, but I only build for debug], is added by me for my project. As you please.

      # C++ objects and libs
      *.slo
      *.lo
      *.o
      *.a
      *.la
      *.lai
      *.so
      *.so.*
      *.dll
      *.dylib
      
      # Qt-es
      object_script.*.Release
      object_script.*.Debug
      *_plugin_import.cpp
      /.qmake.cache
      /.qmake.stash
      *.pro.user
      *.pro.user.*
      *.qbs.user
      *.qbs.user.*
      *.moc
      moc_*.cpp
      moc_*.h
      qrc_*.cpp
      ui_*.h
      *.qmlc
      *.jsc
      Makefile*
      *build-*
      *.qm
      *.prl
      
      # Qt unit tests
      target_wrapper.*
      
      # QtCreator
      *.autosave
      
      # QtCreator Qml
      *.qmlproject.user
      *.qmlproject.user.*
      
      # QtCreator CMake
      CMakeLists.txt.user*
      
      # QtCreator 4.8< compilation database 
      compile_commands.json
      
      # QtCreator local machine specific files for imported projects
      *creator.user*
      
      # AtH stuff
      *.swp
      debug/
      saves/
      
      1 Reply Last reply
      4
      • I idlefrog
        26 Oct 2021, 10:18

        Is there an official template for .gitignore ?

        I've only found this: Using Git

        J Offline
        J Offline
        jsulm
        Lifetime Qt Champion
        wrote on 26 Oct 2021, 10:38 last edited by
        #2

        @idlefrog said in What should be in .gitignore?:

        Is there an official template for .gitignore

        I don't think so. What you should put there depends on your project and needs.

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        1
        • I idlefrog
          26 Oct 2021, 10:18

          Is there an official template for .gitignore ?

          I've only found this: Using Git

          J Offline
          J Offline
          J.Hilk
          Moderators
          wrote on 26 Oct 2021, 10:40 last edited by
          #3

          @idlefrog

          2 things come to my mind:

          • make sure, that you don't add your build folder, so that all compiler generated files are not tracked.
          • the *.user files

          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          1 Reply Last reply
          1
          • I Offline
            I Offline
            idlefrog
            wrote on 26 Oct 2021, 11:05 last edited by
            #4

            Thanks @J-Hilk
            In the end I just went with:

            *.pro.user*
            

            I'll just add to it as I go!

            J 1 Reply Last reply 26 Oct 2021, 11:16
            1
            • I idlefrog
              26 Oct 2021, 11:05

              Thanks @J-Hilk
              In the end I just went with:

              *.pro.user*
              

              I'll just add to it as I go!

              J Online
              J Online
              JonB
              wrote on 26 Oct 2021, 11:16 last edited by JonB
              #5

              @idlefrog
              :) For reference, I paste my own .gitignore (Linux development) below. It's somewhat larger than yours ;-) Taken from a template somewhere. Only the last segment, under AtH [I should probably have added release/ too, but I only build for debug], is added by me for my project. As you please.

              # C++ objects and libs
              *.slo
              *.lo
              *.o
              *.a
              *.la
              *.lai
              *.so
              *.so.*
              *.dll
              *.dylib
              
              # Qt-es
              object_script.*.Release
              object_script.*.Debug
              *_plugin_import.cpp
              /.qmake.cache
              /.qmake.stash
              *.pro.user
              *.pro.user.*
              *.qbs.user
              *.qbs.user.*
              *.moc
              moc_*.cpp
              moc_*.h
              qrc_*.cpp
              ui_*.h
              *.qmlc
              *.jsc
              Makefile*
              *build-*
              *.qm
              *.prl
              
              # Qt unit tests
              target_wrapper.*
              
              # QtCreator
              *.autosave
              
              # QtCreator Qml
              *.qmlproject.user
              *.qmlproject.user.*
              
              # QtCreator CMake
              CMakeLists.txt.user*
              
              # QtCreator 4.8< compilation database 
              compile_commands.json
              
              # QtCreator local machine specific files for imported projects
              *creator.user*
              
              # AtH stuff
              *.swp
              debug/
              saves/
              
              1 Reply Last reply
              4
              • I Offline
                I Offline
                idlefrog
                wrote on 26 Oct 2021, 11:20 last edited by
                #6

                Thanks @JonB, that's much longer & comprehensive compared to my one-liner!
                Very helpful!
                That' should keep me out of trouble for a good while :)

                J 1 Reply Last reply 26 Oct 2021, 11:27
                0
                • I idlefrog
                  26 Oct 2021, 11:20

                  Thanks @JonB, that's much longer & comprehensive compared to my one-liner!
                  Very helpful!
                  That' should keep me out of trouble for a good while :)

                  J Online
                  J Online
                  JonB
                  wrote on 26 Oct 2021, 11:27 last edited by
                  #7

                  @idlefrog
                  As I said, it will have been picked up from some template on the web when I started out. It is doubtless much larger than strictly necessary, like covering tests and QML which I do not even use, and some Qt4 stuff. But it will give you an idea of what might be produced which can be ignored.

                  I 1 Reply Last reply 26 Oct 2021, 11:38
                  0
                  • J JonB
                    26 Oct 2021, 11:27

                    @idlefrog
                    As I said, it will have been picked up from some template on the web when I started out. It is doubtless much larger than strictly necessary, like covering tests and QML which I do not even use, and some Qt4 stuff. But it will give you an idea of what might be produced which can be ignored.

                    I Offline
                    I Offline
                    idlefrog
                    wrote on 26 Oct 2021, 11:38 last edited by
                    #8

                    @JonB It at least gets me somewhere to start from. I doubt I would need to edit it. Thank you!

                    1 Reply Last reply
                    0

                    1/8

                    26 Oct 2021, 10:18

                    • Login

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