Home

This documentation is out of date. Please refer to the latest version.

[Previous: Writing a Simple Program with Qt Creator] [Qt Creator Manual] [Next: Navigating Quickly Around Your Code with Locator]

Qt Creator and Version Control Systems

Version control systems supported by Qt Creator

githttp://git-scm.com/
Subversionhttp://subversion.tigris.org/
Perforcehttp://www.perforce.com

Setup

Qt Creator uses the version control system's command line clients to access your repositories. To set it up, you must ensure that these command line clients can be located via the PATH environment variable. You can specify the path to the command line client's executable in the settings pages that can be found under Options... in the Tools menu.

Usage

You can find the version control menu entires in a sub-menu of the Tools menu. The version control system displayed here is the system that manages the current project.

Each version control system adds a pane to the Application Output panes within which it will log the commands it executes, prepended by a timestamp and the relevant output.

Addings Files

When you create a new file or a new project, the wizards will display page requesting whether the files should be added to a version control system. This depends on whether the parent directory or the project is already under version control and the system supports the concept of adding files, e.g., Perforce and Subversion. Alternatively, you can also add files later on using the version control tool menus.

With git, there is no concept of adding files. Instead, all modified files must be staged for a commit.

Viewing Diff Output

All version control systems provide menu options to diff the current file or project - comparing with the latest version stored in the repository and displaying the differences. In Qt Creator, a diff is displayed in a read-only editor. If the file is accessible, you can double -click on a selected diff chunk and Qt Creator will open an editor displaying the file, scrolled to the line in question.

Viewing Versioning History and Change Details

The versioning history of a file can be displayed by selecting the Log (for git) or Filelog (for Perforce and Subversion) option. Typically, the log output will contain the date, the commit message, and a change or revision identifier. If you click on the identifier, a description of the change including the diff will be displayed.

Annotating Files

Annotation views are obtained by selecting Annotate or Blame. This will display the lines of the file prepended by the change identifier they originate from. Clicking on the change identifier shows a detailed description of the file.

Committing Changes

Once you have finished making changes, you can submit them to the version control system by choosing Commit or Submit. Qt Creator will display a commit page containing a text editor, where you can enter your commit message, and a checkable list of modified files to be included. When you are done, click Commit to start committing. In addition, there is a Diff selected button that brings up a diff view of the files selected in the file list. Since the commit page is just another editor, you can go back to it by closing the diff view. Alternatively, you can view it from the editor combo box showing the Opened files.

Menu Entries Specific to git

The git sub-menu contains additional entries:

StashStash local changes prior to executing a pull.
PullPull changes from the remote repository. If there are locally modified files, you will be prompted to stash those changes.
Branches...Displays the branch dialog showing the local branches at the top and remote branches at the bottom. To switch to the local branch, simply double-click on it. Double-clicking on a remote branch will first create a local branch with the same name that tracks the remote branch, and then switch to it.

[Previous: Writing a Simple Program with Qt Creator] [Qt Creator Manual] [Next: Navigating Quickly Around Your Code with Locator]


Copyright © 2008 Nokia  
Qt Creator 1.0.0