Using Visual Studio 2015, how to commit only one file?

Ryan Betker - healthNCode picture Ryan Betker - healthNCode · May 4, 2016 · Viewed 21.7k times · Source

What I've tried: I don't recall to have an issue when in VS2013. When in VS2015, I've tried the context menu inside one code file or right clicking just that file from Solution Explorer, yet it includes all changed files.

I've also tried filtering and that doesn't help narrow down the checkin.

Answer

Jay Adams picture Jay Adams · Sep 6, 2016

If you're using Git with Visual Studio 2015, from Team Explorer, right-click on just the file(s) you want to commit and select Stage.

Now you'll have a new section above Changes called Staged Changes that only contain the file(s) you want. Type in your commit message and then select Commit Staged. Everything else will still be untouched under Changes.