最初の変更をコミットする
Git を使用する際は、通常、ローカルの変更内容をチェックアウトしてステージングし、ローカルリポジトリにコミットしてから、リモートリポジトリ(origin)にプッシュします。
作業を開始する前に、Preferences >Version Control >General で Git をセットアップしてください。詳細については、「Git のセットアップ」を参照してください。
ユーザー認証情報の設定
Gitにはユーザー名とメールアドレスが必要ですので、まずそれらを設定してください:
git config --global user.name "Jon Doe" git config --global user.email "Jon.Doe@company.com"
新しいリポジトリへのコミット
最初の変更をコミットして新しいリポジトリにプッシュするには:
- 変更の追跡を開始するには、Tools >Git にアクセスし、Create Repository を選択します。
- ローカルの変更を確認するには、Tools >Git >Local Repository に移動し、「Diff 」を選択します。

Git Diff リポジトリビュー
- 変更された行を右クリックし、「Stage Chunk 」を選択してそのチャンクをステージング領域に追加するか、「Stage Selection 」を選択して選択した行をステージング領域に追加します。
- ステージングされた変更をローカルリポジトリにコミットするには、[Tools ] > [Git ] > [Local Repository ] の順に進み、[Commit] を選択します。

Git コミット画面
- コミットするファイルを選択し、[Commit <n/m> File(s) ] を選択して、変更をローカルリポジトリにコミットします。
- コミットした変更をリモートリポジトリにプッシュするには、[Tools ] > [Git ] > [Remote Repository ] の順に移動し、[Push] を選択します。
ローカルブランチにリモートリポジトリ内のアップストリームブランチがない場合、Qt Creator から、そのブランチを作成してorigin として設定するよう促されます。
既存のリポジトリへのコミット
既存のリポジトリに最初の変更をコミットしてプッシュするには:
- リモートリポジトリから変更をプルするには、Tools >Git >Remote Repository に移動し、Pull を選択します。
- プル操作の前にすべてのローカル変更をスタッシュし、プルされた作業ツリーの状態の上にスタッシュを適用するには、Stash & Pop を選択します。
- 変更をローカルリポジトリにコミットするには、[Tools ] > [Git ] > [Local Repository ] に移動し、[Commit] を選択します。
- コミットした変更をリモートリポジトリにプッシュするには、Tools >Git >Remote Repository に移動し、「Push 」を選択します。
「Git の使用方法」および「 Git の活用」も参照してください 。
Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.