IntelliJ IDEA 2017.1 Help

Committing Changes to a Local Git Repository

This topic describes how to commit changes to a local Git repository. For information on uploading changes to a remote repository, see Pushing Changes to the Upstream (Git Push).

To commit changes to a local repository, do the following:

  1. Open the Version Control tool window by pressing Alt+9 or choosing View | Tool Windows | Version Control.
  2. In the Local Changes tab, select the files or folders you want to commit.
  3. Invoke the Commit Changes dialog box by doing one of the following:
    • On the tool window toolbar, click the Commit Changes button Icon.
    • Select Commit Changes from the context menu of the selected file or changelist.
    • On the main menu, choose VCS | Commit Changes or VCS | Git | Commit File.
    • Press Ctrl+K.

    The Commit Changes dialog lists all files that have been modified since the last commit, and all newly added unversioned files.

  4. Select the checkboxes next to the files you want to commit.
  5. Enter a commit message and select the before commit actions you want IntelliJ IDEA to perform before committing the selected files to the local repository.
  6. Select the following options in the Git section if necessary:
    • Author: if you are committing changes made by another person, you can specify the author of these changes.
    • Amend commit: select this option if you want to replace an already published commit (see Git Basics: Undoing Things for details).
    • Sign-off commit: Select this option if you want to sign off your commit, i.e. to certify that the changes you are about to check in have been made by you, or that you take the responsibility for the code in question.

      When this option is enabled, the following line is automatically added at the end of the commit message: Signed off by: <username>

  7. Click the Commit button, or hover your mouse over this button to display one of the following available commit options:
    • Commit and Push: select this option to push the changes to the remote repository immediately after the commit. This option is available if you are using Git or Mercurial as a version control system.
    • Create Patch: select this option if you want IntelliJ IDEA to generate a patch based on the changes you are about to commit. In the Create Patch dialog that opens, type the name of the patch file and specify whether you need a reverse patch.
    • Remote Run: select this option to run your personal build. This option is only available when you are logged in to TeamCity. Refer to TeamCity plugin documentation for details.

See Also

Last modified: 18 July 2017