We are excited to announce the release of the Copy Git Permalink feature in Visual Studio 17.12. This new functionality streamlines the process of sharing code references, enhancing collaboration and ensuring that critical context is preserved.
Effortless Code Sharing
If you’ve found yourself needing to share code snippets with colleagues, you know the challenges of preserving context. With the new Copy Git Permalink feature, you can now generate a permalink directly from Visual Studio to the remote repository. Simply select the desired code, right-click, and choose the “Copy Permalink” option under the Git submenu. Then, your colleague can open the link you shared to get to that line of code on the web, providing them with the surrounding code without disrupting their local environment.
This feature supports both Azure DevOps repositories and GitHub (requires sign-in). If you’d like the ability to extend the support for your own favorite Git hosting provider, please upvote this Visual Studio Extensibility suggestion ticket.
Best Practices for Accuracy
To ensure that your permalink reflects the latest code, remember to commit and push your changes before generating the link. Visual Studio will automatically find the most recent commit on the web if your changes haven’t been pushed recently.
To include line and column numbers in your permalink, make sure the text of interest is selected.
Historical Code Reference
The Copy Git Permalink option is also available within the embedded commit details view in the Git Repository window. This allows you to reference specific code from previous commits without switching branches.
From Marketplace to Product
This started as a hackathon project of a Visual Studio engineer, Etienne Baudoux, which turned into the popular Copy Git Link extension. The productivity gains experienced by internal Microsoft adopters and the votes received in a related suggestion ticket made it clear that an in-box alternative to this extension would be appreciated.
Conclusion
We encourage you to explore the new Copy Git Permalink feature and share your feedback with us. We are committed to enhancing your development experience and look forward to hear your thoughts.