Git: Adding Files to a Repository

See Also

The IDE enables you to track a new file and also to stage changes to an already tracked file in the Git repository. You effectively add your sources into a local Git repository. The repository files are placed under a .git directory under the project directory.

To add files to a Git Repository:

When adding files to a Git repository, the IDE composes and saves snapshots of your project first in the Index. After you perform the commit, the IDE saves those snapshots in the HEAD. The IDE allows you to choose between the two workflows described in the following table.

Workflow Description Explicitly add new or modified files to the Index and then commit only those that are staged in the Index to the HEAD Skip adding new or modified files to the Index and commit the required files directly to the HEAD
Steps to Follow the Workflow
  1. In the Projects window, right-click the file you want to add.
  2. In the context menu, choose Git > Add.
    This adds the file contents to the Index before you commit it.
  3. In the Projects window, right-click the file you want to commit.
  4. In the Commit dialog box, select the Changes between HEAD and Index toggle button.
    This displays the list of files that are already staged.
  5. Commit the file(s) as described in the Committing Sources to a Repository section below.
  1. In the Projects window, right-click the file you want to commit.
  2. In the context menu, choose Git > Commit.
  3. In the Commit dialog box, select the Select the Changes between Index and Working Tree toggle button.
    This displays the list of files that are not staged.
  4. Commit the file(s) as described in the Committing Sources to a Repository section below.

Note:

See Also
About Git Support
Git: Committing Sources to a Repository

Legal Notices