This is a simple Visual Studio extension that adds two entries, "Browse in remote repository" and "Copy URL of remote repository version", to the context menu when right clicking a file in solution Explorer, or in the code editor for open files, provided that the solution lives in a Git repository with a configured remote. This is useful when you are coding collaboratively and want to point a specific piece of code to another person.
The format of the generated URL is <remote base URL>/blob/<branch name>/<file path and name>. When clicking in the code editor, #L<line number> is added as well; and if the command is invoked over a multiline selection, -L<end line number> is added to that. This format is compatible with GitHub and GitLab.
Fix: commands not working for files with spaces in the name (filename wasn't surrounded with quotes when passed to git ls-files).
Fix: generated urls for multiline selections created from the bottom end with "L(last line)-L(first line)", and are therefore not rendered properly in the browser.
Fix: invalid url generated for unmerged files.
v1.7 2017-09-10
If the command is executed over a multiline text selection, the url will end with "#Lstart-Lend", thus rendering these lines as selected in the browser.
git rev-parse is now used instead of git branch to get the current branch name (except if there's a rebase in progress, see below)
Best-effort rebase-in-progress support implemented: if git rev-parse gives "HEAD" as the current branch name, git branch is used, then a line with the format "* (no branch, rebasing branchname)" is searched for in the output, and the branch name is extracted from there.
v1.6 2017-05-30
git rev-parse is now used instead of git status to check if the current solution is living in a repository, much faster and prevents VS from hanging if there is a lot of pending changes
v1.5 2017-02-17
git ls-files is now used to get the file paths and names as they exist in the repository, this prevents issues when there is a casing mismatch with the name that appears in the project file
v1.4 2017-01-19
SSH base URLs are now automatically converted to HTTPS, no need to manually configure it
v1.3 2017-01-16
Added support for Visual Studio 2017
v1.2 2017-01-11:
Fix: context menu entries appearing even if the files are not in a Git repository
Fix: line number being included in the generated url whenever the file is open in code editor, even if menu entry is clicked from solution explorer
Fix: context menu entries not appearing in code editor for .css, .less, .scss, .json, .md, .asp, .wsf and .xaml files
v1.1 2017-01-10:
Fix: context menu entries not appearing in code editor for .cshtml files
Fix: context menu entries not appearing in solution explorer when using "Open Web Site"