Supercharge your Git experience in VS

Taysser Gherfal

Have you experienced delays when viewing your Git repository or branch history in Visual Studio? Have you run a network command like force-push and had to wait for the operation to complete? Your Git repository may be having performance issues due to its large size. We are happy to integrate a relatively new Git feature called the commit graph which leads to improving the performance of your Git operations and significantly improving performance in Visual Studio.

Commit Graph performance improvement

We’ve observed an average of 70% performance improvement in loading branch history in the Git repository window for a repository with 332k commits when enabling the commit graph in Visual Studio. Download the latest preview version of Visual Studio and utilize this feature.

Once you are on the latest preview version of Visual Studio (17.2 Preview 3 or later), Visual Studio will automatically show the following notification where you can choose to enable the commit graph.

Commit Graph notification

Alternatively, you could manually enable the commit-graph by going to Git > Settings > Enable commit graph for better Git performance.

 

What happens when you enable the commit graph?

When the commit graph is enabled, a commit graph file gets generated in your repository which then is used to quickly parse and sort your commits. The commit graph file also includes extra information to help avoid parsing commits. Generating the commit graph is a background operation that could take several seconds up to couple of minutes depending on the size of your repository. It is also a blocking Git operation that will block you from performing other Git operations in Visual Studio like Fetch or Pull. View this blog to read more about how the commit graph works.

 

When should you consider running the commit graph?

You will see most of the value of the commit graph right after you run it for the first time. Visual Studio will only show the commit graph notification when it is not enabled, and when Visual Studio predicts that running the commit graph could enhance performance.

 

How to manually run the commit graph

If you did not receive the notification, you can also choose to manually re-run the commit graph at any time if you have already enabled it in Visual Studio by using the following command line or by disabling and enabling the commit graph in our Git settings Git > Settings > Enable commit graph for better Git performance.

git commit-graph write --reachable

 

Commit graph resources

If you are interested in learning more about the commit graph Git feature, you might find the following resources a good starting point:

 

Let us know what you think

We have benefitted greatly from all the rich feedback we’ve received from you – thank you! We hope you’ll help us continue to improve by giving the new commit-graph feature a try and letting us know what you think by taking the following quick survey:

4 comments

Discussion is closed. Login to edit/delete existing comments.

  • Rod Falanga 0

    Does VS Code also take advantage of the commit graph? Or does VS Code ignore it?

  • Eric Harmon 0

    Try as I might, I can’t ever run Git from the command line. I’ve tried developer command prompt, Terminal, PowerShell, etc. Every time I type ‘git’, I’m told Windows doesn’t recognize it. Can you please tell me where and how to execute the git command-line statement that you mention in this article?

  • 新民 黄 0

    I was unable to push/pull codes to/from remote git server after updates to latest Visual Studio 2022 Community as well as Visual Studio 2022 Community Preview, It looks my local git repository has crashed.
    Environment: Windows 10 Chinese, exFAT disk partition.

  • Alex Ivanoff 3

    I do not see Git > Settings > Enable commit graph for better Git performance option. Visual Studio Enterprise 2022 (64-bit) 17.2.3.

Feedback usabilla icon