简体   繁体   中英

Adding all files in git in Visual Studio 2019

I have a solution with two projects. One of them is the main one and I have the 2nd one referenced. However, the 2nd one isn't added to the git changes, and when I push, it only pushes the main project, not the whole solution. How can I add the whole solution to be tracked by git?

This can happen for a few reasons. Try the following:

  • Check your .gitignore file and make sure you aren't ignoring the second project's folder
  • Check that the second project folder is at the same level or underneath your .git folder
  • Check that your .git folder isn't under your first project folder

Edit: Okay, based on your comment we know the second project is in the wrong place. You could move your second project underneath the first one but I wouldn't recommend it. The convention with Visual Studio is to have projects in separate folders either at the same level or underneath the.git folder. Depending on the complexity of your project it might just be easier to recreate the correct folder structure somewhere else and create a new repository.

See the Dapper project on GitHub for an example of the project layout convention. The Dapper.sln file is at the same level as the .git folder and projects like Dapper.Contrib and Dapper.EntityFramework are in separate folders underneath that.

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