How to use version control with Qt Creator's project settings with many users?

When using Qt Creator with qmake projects, let’s say example.pro, then Qt Creator’s own configuration is normally stored in example.pro.user file. But this file contains user-specific settings, so if many people are working on the project, it is not a good idea to commit it to shared version control repository. Still, this file often contains complex settings for deployment and environment variables, and it would be very good to store these to version control.

Is there a way to store personal project specific Qt Creator settings in version control, and otherwise share them, so that settings of different developers do not get mixed up?

  • Online C project for excercising?
  • Should I commit /bin directory when working with virtualenv?
  • How to search the author of any function or variable in the git project?
  • Error running git“Cannot run program ”git": error=2
  • How do I sync automatically my project in Sublime Text 2 on a remote server when I'm using Git?
  • git project manage with more branch(50)
  • Backup a local working directory on BitBucket - clone or push
  • git push to specific branch
  • Maintaining customized versions of pyramid project (git branches, in-code variation, or other method?)
  • How do I migrate a flat svn repo to git repo
  • Is Git only for source control?
  • Git rebase loses history, then why rebase?
  • One Solution collect form web for “How to use version control with Qt Creator's project settings with many users?”

    You can use QTC_EXTENSION environment variable. So if you normally have

    example.pro.user
    

    Then having environment variable

    QTC_EXTENSION=foobar
    

    When you launch Qt Creater will instead make it use file

    example.pro.foobar
    

    I’m not sure if it is documented anywhere, but it is implemented in this source file (updated May 2015) and has been around since 2011 at least.

    To clone settings for new user, simply copy a settings file to a new name, and set the environment variable to match the one you want. However, I don’t know of an easy way to merge changes after that, other than manually copy-pasting (either with two Qt Creators open at the same time, or by opening the XML files as text).


    Then there is also a way to share settings by manually creating example.pro.shared file (configurable with QTC_SHARED_EXTENSION environment variable, same way as user specific settings). It is usually created by copying a .pro.user file and then editing it to remove non-shared parts, as documented here (updated May 2015).

    Git Baby is a git and github fan, let's start git clone.