# Adding a Project to GIT

> The **GIT Init** feature adds the current project to a local Git repository. Access the command from the **Team** tab, or the status bar.

The **GIT Init** feature adds the current project to a local Git repository. Access the command from the **Team** tab, or the status bar.

1. Create or open a project in Studio. Click the **Start** tab &gt; **Team**. The **Team** tab is displayed.
2. Click the **GIT Init** button, and then select a path where the repository should be initialized. The location may be the same as the project or the parent folder. The **Commit changes** window opens.
3. The **Modified Files** section shows the project’s files that are to be added to the Git repo. Clear the box next to the ones that you don’t want to add or use **Select All**, **Select None**.
4. Select the **Show Unversioned Files** box to add unversioned files to the list. Write a **Commit Message**. Click the **Commit** button to commit the changes to the local Git repository.

When a project is added to GIT, the context menu in the **Project** panel includes GIT-specific options. For more information, see [Context Menu Options for GIT](https://docs.uipath.com/studio/standalone/latest/user-guide/about-automation-projects#about-automation-projects).

:::note
* The `.local` folder, which
contains data cached locally for the project, should not be added to Git.
:::

Use the `.gitignore` file to specify which files and folders should be excluded from Git. When you add a project to a local Git repository, a `.gitignore` file is automatically generated. You can choose not to include the `.gitignore` file in the repository by clearing the box next to it in the **Modified Files** section.

By default, the `.gitignore` file excludes `.local` from being committed. If `.local` is missing from an existing `.gitignore` file, it is automatically added.

## Committing and Pushing to GIT

1. From the same **Commit Changes** window, click the **Commit and Push** button to commit the changes and push them to the remote repository. This **Manage Remotes** window is displayed. The window is also available from the status bar.

   ![docs image](https://dev-assets.cms.uipath.com/assets/images/studio/studio-docs-image-172561-3453473e.webp)
2. In the **Name** section, add the name of the remote repository.
3. In the **URL** section, add the remote URL.

If you want to make modifications to the added repositories, simply click an entry, change the name and URL, then click the **Update** button. When you're done click **Add**, then **Save**. The following message box opens. This means that the local repository is not synchronized with the remote one.

   ![docs image](https://dev-assets.cms.uipath.com/assets/images/studio/studio-docs-image-167081-a7a72387.webp)

* Click the **Overwrite remote content** button to push the local versions of files to the remote repository and overwrite the files there.
* Click the **Pull (rebase)** button to pull the remote files and rebase the current branch.
* Click the **Cancel** button to discard the whole operation.

The number of unpushed changes, and newly added files are visible in the status bar. Click the ![](https://dev-assets.cms.uipath.com/assets/images/studio/studio-image-changes-3886ec63.png) icon to open the **Commit Changes** window, or the ![](https://dev-assets.cms.uipath.com/assets/images/studio/studio-image-push-857e8a48.png) icon to push changes.

:::note
If you edit a file from a project added to source control in an external editor, the change is visible in the **Project** panel and the status bar only after you click **Refresh** ![docs image](https://dev-assets.cms.uipath.com/assets/images/studio/studio-docs-image-refresh-973dda83.png) in the Project panel.
:::

## Changing the Last Commit

Studio integration with Git also comes with an **Amend Commit** option for changing the last performed commit, before the push was performed.

1. Right-click a modified file in the **Project** panel and select **Commit**. The **Commit Changes** window is displayed.

   ![docs image](https://dev-assets.cms.uipath.com/assets/images/studio/studio-docs-image-167665-8d18a6dd.webp)
2. Select the **Amend Commit** box. The last commit message is displayed, together with the files that were committed. To view changes between the current file and the last commit, use the **Show Changes** option.
3. Change the commit message and select the files that you would like to include. Click the **Commit and Push** or **Commit** button.

## Undoing Pending Changes

Studio comes with the option to undo changes that have been made to versioned files, before you commit and push them to the remote repository.

After making changes to a file in the local repository, click **Undo** in the GIT context menu to open the **Undo Pending Changes** window.

   ![docs image](https://dev-assets.cms.uipath.com/assets/images/studio/studio-docs-image-167889-00ce136c.webp)

Select the checkbox next to the files and click **Undo**. The files are now reverted to the state before the changes were made.

:::note
The **Undo** does not cover unversioned files. If you create new files and then select **Undo**, the files are not removed from the project. Once added to the project tree, new files remain there unless they are manually deleted.
:::
