简体   繁体   中英

Issue with Visual Studio Community 2013 and Git

I just noticed the files I created ( .cs , .xaml , etc) are not added to Git , so my commits+push wont upload them to the repository. 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 .

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

Make sure Microsoft Git Provider is selected as your Source Control plugin (assuming Visual Studio 2013):

  1. In Visual Studio, on the Tools menu, click Options.
  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).
  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.

Reference: https://msdn.microsoft.com/en-us/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; 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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