Things to remember while committing .NET code to SVN repository

While working on .NET projects, I analyzed that most of the developers make some common mistakes while committing code to SVN. So, I have identified those common mistakes and collaborated them as SVN guidelines to be followed for .NET code. Those are as follows:

  1. We should not check in the debug files like .pdb files etc.
  2. We should not check in local settings file.
  3. We should not check in local DLLS.
  4. We should not check in bin and other local folders.
  5. We should not check in debug and published folders or any other information like “My Project” folder.
  6. We should not check in our solution files (.sln) until and unless we have added or removed any vb project.
  7. Never commit .suo file.
  8. We should not check in .vbproj file until and unless we have added or removed any file, sub-folder or reference to that particular project.
  9. We should not check in .vbproj.user file as it is local system specific file of user.
  10. Always remember to commit .vbproj file if you have added or removed any file, sub-folder or reference to that particular project. But before committing the code take a diff of this file and include only file information and not any unnecessary information like compile time changes or local reference changes etc.
  11. We should not check in web.config until and unless there are some code changes that are not user machine specific.
  12. Similarly if you are adding or deleting a project, then always remember to check in .sln file but before that take a diff and check in only the required changes of file and not the local version information.
  13. Always take a difference of all the changes in your folder before you check in. If you are using Tortoise SVN client, then you can follow the below steps:
  • Go to the parent folder of your repository.
  • Right click -> Tortoise SVN -> check for modifications

15

  • This will open up a window listing all the files, folders that are modified
  • Please keep in mind, to check the “Unversioned” which will also display the newly added files in your repository.

16

  •  To include newly added file, you have to right click that particular folder or file and Add into the SVN before commit. If you created new files and/or directories during your development process then you need to add them to source control too. Select the file(s) and/or directory and use TortoiseSVN → Add. If you add a file or folder by mistake, you can undo the addition before you commit using TortoiseSVN → Undo add….
  • If you want to delete some file or folder, you need to right click and Delete into the SVN before commit. When you TortoiseSVN → Delete a file or folder, it is removed from your working copy immediately as well as being marked for deletion in the repository on next commit. The item’s parent folder shows a “modified” icon overlay. Up until you commit the change, you can get the file back using TortoiseSVN → Revert on the parent folder

17

  • you want to delete an item from the repository, but keep it locally as an unversioned file/folder, use Extended Context Menu → Delete (keep local).
  1. If a Subversion command cannot complete successfully, perhaps due to server problems, your working copy can be left in an inconsistent state. In that case you need to use TortoiseSVN → Cleanup on the folder. It is a good idea to do this at the top level of the working copy.
  2. In projects you will have files and folders that should not be subject to version control. These might include files created by the compiler, *.obj, *.lst, *.pdb maybe an output folder used to store the executable. Whenever you commit changes, TortoiseSVN shows your unversioned files, which fills up the file list in the commit dialog. The best way to avoid these problems is to add the derived files to the project’s ignore list. That way they will never show up in the commit dialog, but genuine unversioned source files will still be flagged up. If you right click on a single unversioned file, and select the command TortoiseSVN → Add to Ignore List from the context menu.

18

 

About the Author

Aarti Ahuja

Aarti Ahuja

Related Posts

X