Git remains a growing, if not an essential part of most developer's toolkits, and making its myriad of features accessible is an important part of any modern IDE. In Visual Studio 2017, Microsoft has expanded the number of Git features available to developers from its UI rather than having to resort to using Git from the command line.
Included among the new features is SSH support for VS2017's Git client. Microsoft's Kayla Ngan observes that this is possible thanks to VS2017 switching to using git.exe
to provide its Git support. Previously, Git support under Visual Studio required https
to be configured on the server hosting the repository which limited accessibility. Unfortunately, full SSH support remains incomplete because one cannot clone a repository via SSH from within the IDE. Instead, the repository has to be cloned from Visual Studio's Developer Command Prompt, after which the repository is pushed/pulled/etc. as needed. Ngan says that the ability to clone from within the IDE will be added in a future update (note that this does affect the cloning of Git repositories via https
).
Another new Git addition is in the Global Settings screen for Git (under Team Explorer) where there is a new option to add push --force-with-lease
which will alert you before executing a push that would otherwise overwrite someone else's work (due to changes in the upstream branch). The warning will not prevent the push, but rather provide the opportunity to confirm that this is your intention.
Viewing and comparing the diffs is easier in VS2017. A summary of outgoing commits is visible from the Sync page. Added to this is the ability to view the Local History of the commits for your repository and compare two different diffs with the Compare Commits context menu option.
There are some additional requested Git features that remain on the future roadmap, including:
- Pushing tags to the remote server
- Fetch --prune
- Pull --rebase
A frequently reported error message with those using VS2017 in their current workflow is "Index was outside the bounds of the array." According to user Rain, the solution is to commit changes before making a pull request—while another user Tony indicated that this error coincided with his inability to make any kind push.
Those interested in more information regarding VS2017 and Git can reference Microsoft's quick start guide which includes instructions for those using previous versions of Visual Studio.