How to use github with visual studio to make only source files available publicly

I use git with visual studio for version control (Arduino projects) and quite recently I started using github as a remote repository.
When pushing changes to github (from within visual studio), not only Arduino c++ (.ino) files are pushed, but a number of xml files as well (which is normal, of course).
But: do these xml files have any value for a user downloading my source code ? Is it a good practice to create a separate repository with only source code (and documentation) files ? And if yes, is there a standard way of achieving this ?

I’m not familiar with Ardunio programming so I can’t say if it makes sense, but on the git level, there are two things you can do:

  • Don’t add and commit files you don’t want to have in the repository. I know it’s common to just add the whole repository directory, but in many cases it is better to check and add individual files (or even sections of files). It helps prevent mistakes.
  • Add the files you don’t want to commit (or suitable wildcard patterns, e.g. *.xml) to a .gitignore file. That way they won’t be accidentally committed, and not even shown as new files by git. Note that .gitignore only works on untracked files, if you want to ignore files that are already part of the repository you’ll have to remove them from the repository first.

Thank you very much airower-luna. I’ll try it out !

1 Like