简体   繁体   English

Visual Studio Community 2013和Git的问题

[英]Issue with Visual Studio Community 2013 and Git

I just noticed the files I created ( .cs , 我只是注意到我创建的文件( .cs .xaml , etc) are not added to Git , so my commits+push wont upload them to the repository. .xaml等)未添加到Git中 ,因此我的commits + push不会将它们上传到存储库中。 I know I can go to the terminal and do git add path/to/file but I want to know how can I do this from within Visual Studio . 我知道我可以去终端并git add path/to/file但我想知道如何在Visual Studio中执行此操作。

I tried right-click the file and search for Add to source control but the option is not listed. 我尝试右键单击该文件,然后搜索“ 添加到源代码管理”,但未列出该选项。 What do I do? 我该怎么办?

I already looked it up but every Microsoft documentation is for Team Foundation and it doesn't work for me 我已经查找过了,但是每个Microsoft文档都适用于Team Foundation,对我而言不起作用

Make sure Microsoft Git Provider is selected as your Source Control plugin (assuming Visual Studio 2013): 确保选择Microsoft Git Provider作为您的Source Control插件(假设使用Visual Studio 2013):

  1. In Visual Studio, on the Tools menu, click Options. 在Visual Studio中的“工具”菜单上,单击“选项”。
  2. In the Options dialog box, click Source Control, then click Plug-in Selection. 在“选项”对话框中,单击“源代码管理”,然后单击“插件选择”。
  3. Select the source control plug-in that you want to use (Microsoft Git Provider). 选择要使用的源代码管理插件(Microsoft Git Provider)。
  4. Click OK. 单击确定。

Locks should appear next to your files (assuming your project is a git repository), and you should be able to add your files. 锁应该出现在文件旁边(假设您的项目是git存储库),并且您应该能够添加文件。

Reference: https://msdn.microsoft.com/en-us/library/axafab5c(v=vs.90).aspx 参考: https : //msdn.microsoft.com/zh-cn/library/axafab5c(v=vs.90).aspx

Edit: Since you already have your plugin set correctly, you likely just need to perform a commit. 编辑:由于您已经正确设置了插件,因此您可能只需要执行一次提交。 I don't believe Visual Studio has a seperate interface for staging changes; 我不认为Visual Studio具有用于进行更改的单独界面; when you go to commit, it should list your new files as "Included Changes", and the file should have a green plus next to it in the Solution Explorer. 当您提交时,它应将新文件列为“包含的更改”,并且在解决方案资源管理器中,该文件旁边应带有绿色加号。

Any files that aren't being committed should be listed under Excluded Changes or Untracked Files below that. 任何未提交的文件都应在其下方的“排除的更改”或“未跟踪的文件”下列出。 You can add individual files to the commit from here. 您可以从此处将单个文件添加到提交中。

If your file is missing the green plus, I'd check your .gitignore file to ensure it's not being ignored. 如果您的文件缺少绿色加号,我将检查您的.gitignore文件以确保不会被忽略。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM