I would like to know how to push .cpp files and .h files in visual studio 2017. whenever I do a commit i push the solution and everything in the build folder. I just want to be able to push .cpp files and header files whenever i edit them. Im using windows 10 but I do recall on linux, using vim, the task was simpler, because i used the command line.
Add a .gitignore to your root of this solution with following contents:
build
This should ignore all the files and folders within you build directory.
I think the best thing to do is just to learn the command line syntax on windows with Git bash. Most online help is given with the command line syntax in mind.
Related
I have been following tutorials which have me download and unzip projects which contain .sln files for me to open. Following them this way is pretty easy. However, I want to be able to download a single .cpp file and run it without creating a project. I just want to get straight to into it. In Code::Blocks, setting this up is easy to figure out. For some reason, I can figure it out in Visual Studio.
I want to be able to download a single .cpp file and run it without creating a project.
You cannot. Visual Studio does not support this. A project is always required, even if it only contains a single source code (.cpp) file.
You can, however, run a single .cpp source file through Microsoft's C++ compiler on the command line (cl.exe), and then execute it. But this doesn't involve anything about the Visual Studio IDE.
if you have the source code, you could make a .cpp file by right-clicking and adding one and then ctrl+s then f5 and it might run... Idk.
When I created a C++ console project in Visual Studio, I found that besides .cpp files, I had other files like .sln, .vcxproj, .filters, .user.
Should I add them to Git repo?
You can download a .gitignore for Visual Studio. It will make sure only what's necessary to open and work on the project would be tracked, the rest would be ignored.
You can download one from here:
https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
I'm working on a solution (C#) with 3 projects in it (one library and two applications) and I wonder what is the bare minimum of files you need to commit to be able to pull off a fresh solution and get it to work right away?
Obviously all source files, *.sln, *.csproj are needed and not the obj folder or bin folder (unless I want to keep a working copy of the compiled files).
But do I need to commit the:
Properties folder
.vs folder
*.resx
*.config
I have Googled it but all I found was a list of the file types, but no explanation of what files where critical to make the solution/project load and compile.
[EDIT]
It has been suggested that this is the same question as: Should I add the Visual Studio 2015 .vs folder to source control?
The question is not related to only the .vs folder, but to all project/solution files.
Though SVN and Git are different Version Control System, I think the files that should be excluded in the Version Control System should be similar. This file is a ignore file for Git (an .gitignore), but should be work as it should in SVN Version Control Systems.
https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
This file is often used in various places like Github Destktop, or the Github Site itself.
I am working on a project containing java and c++ files. The java files are edited in Eclipse, and c++ files in Visual Studio. I use SVN on Eclipse to commit changed files into repository. There is no problem with files edited in Eclipse itself, however, the files edited outside Eclipse are not recognized as changed (outgoing) unless I open them in Eclipse. Is there a way to force Eclipse to check all the files for changes, so that I do not need to keep track of changed c++ files myself?
Use the "refresh" command on the folder containing the changed files.
Overview:
I am wanting to allow visual studio 15 to automatically add an existing source file after I generate them.
Full explanation:
I am currently generating a lot of new .h and .cpp files with other tools outside of the IDE using bat scripts and such but needing to use them within the IDE to integrate with the project. As such I would be great if there was a a way to allow VS to add these source files automatically after they are generated without having to add them manually.
The files are always generated into the same given folder path if that helps.
You could generate the project with a CMake script. When you run your batch file, you could have it re-invoke CMake to update the project with the new sources. If you are generating files, especially if you can't predict the names in advance, you will likely want to use the CMake's file(GLOB ...) command.