# The Source Control Panel

> Source Control panel in Studio that provides a complete Git workflow including commit, push, pull, and branch management for open projects.

The **Source Control** panel provides a complete Git workflow inside Studio. The panel is available whenever a project that belongs to a Git repository is open. It is docked to the left of the designer together with other panels (**Explorer**, **Activities**, **Snippets**, etc.).

The **Source Control** panel works only with Git repositories. Projects managed with TFS and SVN are still managed from the **Team** backstage tab.

The first time you open the panel, you are instructed to initialize a local Git repository. This step is mandatory and is performed automatically by selecting the **Initialize Repository** button.

## Panel Structure and Navigation

The panel contains two distinct sections:
1. **Changes**: Lists all files that have been modified, added, deleted, or renamed in the working tree and hosts the commit controls.
2. **Graph**: Renders the repository's commit history as an interactive visual graph.

Clicking each section header collapses or expands the corresponding section. When a section is collapsed, its header displays the number of items it contains, allowing you to monitor activity at a glance.

## The Changes section

The **Changes** section lists all pending file changes, separated into staged and unstaged groups. 

Each file entry features a color-coded status letter (**M** – modified, **A** – added, **D** – deleted, **R** – renamed, **U** – untracked).

Hover over or right-click a file to access file-specific options:
* **Open File**, to open the file in the **Designer** panel.
* **Discard Changes**, to revert the file to its last committed state.
* **Stage** or **Unstage**.
* **Add to .gitignore**, to exclude the file from future tracking.
* **Reveal in File Explorer**, to open the file's location on your machine.
* **Reveal in Explorer View**, to open the Explorer panel.

Use the **Message** field to write your commit message. To have Autopilot write it, select **Generate commit message**. Autopilot uses your staged changes, or all your changes if none are staged. **Generate commit message** is available when generative AI features are enabled and Studio is connected to Orchestrator.

After writing your message, select **Commit** or use the CTRL + Enter keyboard shortcut. If no files are explicitly staged when you commit, all changes are staged automatically.

Select the arrow next to the **Commit** button to access more options:
* **Commit**: Commits staged changes locally. 
* **Commit (Amend)**: Adds staged changes to the most recent commit.  
* **Commit and Push**: Commits then pushes to the remote branch. 
* **Commit and Sync**: Commits staged changes, then pulls and pushes to sync with the remote branch.

Select the **Refresh** button at the top of the **Changes** section to reload the section. 

You can also select the **More options** button to:
* Access the **Pull**, **Push**, and **Fetch all remotes** operations.
* **Stage all** changes.
* Open the **Manage Branches** window.
* Open the **Stash Changes** dialog or the **Manage Stashes** window — see [Stashing changes](#stashing-changes).

An ahead/behind badge next to the branch name in the toolbar shows the number of commits your local branch is ahead of and behind the remote tracking branch.

## Stashing changes

Switching branches or pulling an urgent fix on top of unfinished work no longer means leaving Studio for a third-party Git client. Select **Stash Changes** from the **More options** menu to set your working tree aside, or **Manage Stashes** to bring it back.

The **Stash Changes** dialog saves your current working tree, with two options:
* **Stash message (optional)** - a note to identify the stash later.
* **Include untracked files** - also stashes files Git isn't tracking yet.

Select **Stash** to save the working tree, or **Cancel** to close without stashing.

The **Manage Stashes** window lists every stash you've put aside, with its message and creation date, and three actions:
* **Apply** - apply the stash and keep it in the list.
* **Pop** - apply the stash and remove it from the list.
* **Drop** - delete the stash without applying it. This asks for confirmation first: *"Are you sure you want to delete this stash? This action cannot be undone."*

If a stash can't be applied cleanly - because there are staged changes, or because the files it touches have uncommitted modifications - nothing is changed and the stash is kept, with a message naming which of the two it was. For example, applying a stash that touches a file with uncommitted modifications shows: *"The stash could not be applied because some of the files it changes have uncommitted modifications. Nothing was changed and the stash was kept. Commit or discard those modifications and try again."*

If the stash list changed outside Studio, the **Manage Stashes** window refreshes it and asks you to retry rather than acting on a stale list.

## The Graph section

The **Graph** section renders your repository's commit history as a visual, multi-lane graph. The section displays up to 200 commits, with branch and tag labels, color-coded branch lines, and Bezier curves to illustrate merge connections. 

Select the branch filter button to switch between which commits to display:
* **Auto**: commits on the current branch.
* **All**: commits across all branches.
* Commits only on a specific branch.

Separate buttons allow you to access functions such as:
* **Fetch all remotes**: Downloads remote changes without merging them.
* **Pull**: Downloads and merges remote changes into the current branch.
* **Push**: Uploads committed local changes to the remote branch.

You can also **Refresh** the section from the dedicated button.

Each row in the **Graph** section represents one commit. Hovering over a commit shows you the commit author, date, message, and abbreviated SHA. You can also copy the full SHA to the clipboard.

Files that have been changed are listed under the **Changed files** list. Right-click a file to from the list and select **Compare with Previous Commit** to open a diff view in the designer.

Right-clicking a commit gives you access to the following options:
* **Checkout Commit**: Checks out the repository at the selected commit.
* **Checkout Branch**: Switches to the branch associated with the selected commit.
* **Cherry-Pick Commit**: Applies the commit's changes to the current branch.  
* **Revert Commit**: Creates a new commit that undoes the changes introduced by the selected commit.
* **Reset Soft**: Moves the branch pointer to the selected commit, keeping all subsequent changes staged.
* **Reset Hard**: Moves the branch pointer to the selected commit and discards all subsequent changes.
* **Compare with Working Tree**: Opens a diff between the commit and your current local files.
* **Compare with Previous Commit**: Opens a diff between the commit and its parent commit.  
* **Copy Commit SHA**: Copies the full commit SHA to the clipboard.

Clicking a file anywhere in the **Source Control** panel (in the **Changes** area or in an expanded commit row in the **Graph** area) opens the diff view.

![Source Control panel showing a modified Main.xaml in the Changes section, two commits in the Graph section, and the changed files of the selected commit](https://dev-assets.cms.uipath.com/assets/images/studio/the-source-control-panel-panel-5d2c6817.webp)
