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

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


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.


OR, or, you can always do this in git bash(windows).Make sure you open git bash in your project folder and type following commands:

$ git add fileToCommit.extension$ git commit -m "This is my commit message"

Push when you are done:

$ git push


I have Visual Studio 2019 Community Edition and the tab "Team Explorer" doesn't work for me so @JayAdams' answer is of no use for me. I also don't want to dabble with the command line if I can avoid it, so I found this other way:

  1. Find the 'Git Changes' tab next to the 'Solution Explorer' one.
  2. Stage only the file you want by right-clicking it and click "Stage".
  3. After doing the last step above, the button that said "Commit All" now says "Commit Staged", so you can use it now safely.