问题
I have been using the Git integration from within the Team Explorer section in Visual Studio 2015.
I have an number of config files in my solution that require modifications in order for the application to run locally but I don't want to commit those changes.
In VS2015 Update 1 there was an 'exclude' option in the 'Changes' section of the Git integration that I could select the modified config files and exclude them from the set of changes. Those files would then not appear in the list of modified files going forward so they stayed excluded for future commits.
Yesterday I installed Update 2 and now that exclude option has gone. I can't even see an 'ignore' so now I have to manually select the modified files and stage them each time which is now an extra step and has potential for me committing the local config changes by accident. I realise that having a staging area for the files about to be committed is the norm but the default for VS is to just commit everything. If I want to exclude the config files then I need to stage the other files and then commit.
Is there a way of getting back the previous functionality with the exclude option or failing that of ignoring the config files within the VS Git integration. I don't really want to add the config files to the Git ignore list because sometimes I do change those files legitimately and want to commit them.
回答1:
Visual Studio now follows the Git terminology instead of the TFS source control Include/Exclude. In Git your changes are un-staged by default. From now on that's the case in VS too, and you can right click on the files you want to gather for the next commit and select "Stage". Once you staged some files, you can commit these staged files exclusively by Commit Staged
button (the caption changes from Commit All
after you stage at least one file).
As a shortcut however, when you want to commit every changed files at once - and all of them are unstaged initially - you can stage and commit them with one click with Commit All
button.
First this surprised me. But knowing the Git terminology it totally make sense. Include/Exclude comes form the original TFS source control mechanisms, it served similar purpose, but it could have been confusing for those who where new to VS but knew Git.
来源:https://stackoverflow.com/questions/36909473/visual-studio-2015-update-2-team-explorer-missing-exclude