New Git Features in Visual Studio 2017

We’ve added new Git features to Visual Studio 2017 that allow you to do more of your end-to-end workflow without leaving the IDE. You can perform a force push to complete a rebase or push an amended commit, easily view the diff for outgoing commits, unset your upstream branch, and continue patch rebase from VS. Additionally, because we moved to git.exe–which allows us to provide the most up-to-date features–we support SSH, respect your config options, and show in Team Explorer exactly what you see in the command line. Learn more about all of our Git features in Visual Studio and check out the Visual Studio release notes for what’s new in Visual Studio 2017.

Push force

When you rebase your branch or amend a commit, you’ll need to force push your changes to the remote branch. In Visual Studio 2017, you can now push --force-with-lease from the IDE. Rather than expose push --force, we’ve built the safer push --force-with-lease option. With --force-with-lease, your force push will only complete if the upstream branch has not been updated by someone else. This option safeguards you from accidentally overwriting someone else’s work.

To enable push --force-with-lease, you will need to enable it in Git Global Settings: team-explorer-git-settings

Now, when you initiate a push that will require --force-with-lease (such as a rebase or amend), you’ll be notified and asked to confirm if you want to proceed with push --force-with lease: push-force-with-lease

View Commit Diff

When you’re ready to push your commits, it can be helpful to review your changes. With Visual Studio 2017, you can now easily view the diff for your outgoing commits. If you go to the Sync page and choose “View Summary” under Outgoing Commits, you will see the diff.

You can also view the diff between any two commits. On the History page, select two commits then choose “Compare Commits…” in the context menu. In Team Explorer, you will now see the diff between these two commits. view-commit-diff

Unset Upstream Branch

In the event that you want to stop tracking an upstream branch, go to the Branches page, right click on a local branch, and unset its upstream: team-explorer-branches

SSH Support

Visual Studio 2017 supports SSH! In Repository Settings, you can set your remotes to use SSH: ssh-support

There is a known issue where cloning via SSH on the Connect page does not work. A fix will be available in an update.

As always, please leave your feedback in the comments, on UserVoice, or Report a Problem in the top right of Visual Studio.