// Copyright (C) 2024 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \page getting-sources-from-git.html \title Getting Qt Sources from the Git repository \brief This page describes how to clone and initialize Qt repositories. This page describes how to get the Qt sources from the public Git repositories. The Git repositories contain the latest development branches and released versions of Qt 6. You can also get the Qt sources \QOI, through your \l{Qt Account} (commercial users), or from \l{https://download.qt.io}{download.qt.io} (open-source users). You need a recent version of \l Git and \l{CMake Documentation} to run the \c init-repository tool when initializing the Git submodules. \note These instructions assume you are familiar with using command-line tools. \section1 Cloning the Qt repository Qt is developed and maintained in several Git submodules in the main \c{qt5.git} repository. Getting the Qt sources from Git involves cloning the top-level Git repository through the command line. \note Qt 5 and Qt 6 share the same repository, \c{qt5.git}, and you will get the Qt 5 repository even if you use Qt 6. These instructions use Unix-like shell syntax. On Windows, the commands are similar. The command below clones the current version of Qt 6 into a directory named \c{qt}. \badcode \QtVersion git clone --branch v\1 git://code.qt.io/qt/qt5.git qt \endcode If the git protocol is blocked by your firewall, consider using HTTPS instead: \badcode \QtVersion git clone --branch v\1 https://code.qt.io/qt/qt5.git qt \endcode After cloning, the \c qt directory contains the main Qt Git repository which contains setup files and uninitialized Qt submodules. \section1 Initializing the Qt submodules The \c qt5.git repository contains the \l{All Modules}{Qt Modules} as Git submodules. To initialize and clone the submodules, run the \c init-repository tool in the top-level directory. \badcode ./init-repository \endcode On Windows, without a Linux environment, use \c init-repository.bat instead. \badcode init-repository.bat \endcode \c init-repository clones and initializes setup files to build the Qt sources. In addition, there are tools in the repository that help Qt contributors with creating patches, testing code, and generating documentation. For more information about contributing, visit the \l{Contributing to Qt} site. If you already have a Qt repository in the same directory, you can pass \c -f to force \c init-repository to reinitialize the submodules. \badcode ./init-repository -f \endcode \section1 Initializing Qt specific submodules If you only need a specific set of Qt modules, initialize a minimal set of submodules using \c{--module-subset} as an argument to \c{init-repository}. For example, you can initialize only the \l{Qt Essentials} modules by specifying \c essential as the argument. \badcode ./init-repository --module-subset=essential \endcode For \l{Qt Add-Ons}, use \c addon instead. \badcode ./init-repository --module-subset=addon \endcode You can also select several submodules at the same time. For example, to initialize the \c qtgrpc and \c qtmqtt submodules along with their required submodules, run: \badcode ./init-repository --module-subset=qtgrpc,qtmqtt \endcode The \c init-repository tool always initializes a minimum set of submodules. For more information, consult the \c init-repository manual by setting \c -help as an argument: \badcode ./init-repository -help \endcode \section1 After cloning and initializing The next step is to configure and build Qt. Read the \l{Building Qt Sources} page for more information. */