Git Web Links for Visual Studio 2022Copy links to files in their online Git repositories from inside Visual Studio 2022. Works with:
For on-premise hosts (for example, GitLab CE, Bitbucket Server, etc), there is some configuration required. See below for more details. Copy a Link to a FileTo copy a link to the file, right-click on the file's tab and select Copy Link to File. You can also right-click on a file in Solution Explorer and select Copy Link to File. Copy a Link to the SelectionTo copy a link to a particular line in the file, right-click on the line in the editor and select Copy Link to Selection. If you want to copy a link to a range of lines, just select the lines first. Copy a Link to a Specific Branch or CommitIf the current commit, current branch of default branch is not suitable, you can choose which commit or branch to copy a link to by using the Copy Link to Target... menu item. This command can be useful if you need to share a link to code that is not on the default branch, and your current branch has not been pushed to the server. For example, your current branch may have branched off an "epic" branch but has not been pushed to the server. You can use this command to create a link to the "epic" branch. The caveat with this command is that if the code you are linking to is different between your current branch and the branch or commit you are linking to, the link may be invalid. Default Link FormatThe commands above will create links using either the current commit hash, the current branch name or the default branch name. The current commit hash is the default format. This can be changed in Tools -> Options -> Git Web Links -> General. The default branch is found by using the remote's Open in BrowserYou can choose to open the links directly in the browser instead of copying to the clipboard. The menu item is hidden by default, but you can change it in Tools -> Options -> Git Web Links -> General. On-Premise ServersIf you use an on-premise server, you will need to specify the URLs of those servers in Tools -> Options -> Git Web Links. You need to specify the base HTTP/HTTPS URL of the server, and if you use SSH, the base SSH URL. Make sure you include any port numbers (if it's not port 80) and context paths. The supported on-premise services are:
RequirementsThis extension requires Git to already be installed and on your PATH. Which Link Format Should I Use?There are three types of links that can be produced, and each have their advantages and disadvantages.
|