Add code under source control.
Once you've created a workspace, the first thing you'll need to do to start working is to add some code under source control. There are several ways to get this done:
- From the command line using the "cm add" command (as was described earlier).
- From one of the integrations: Visual Studio, Eclipse, IntelliJ, etc. The wizard will guide you through the process of adding code and will take care of skipping private files that shouldn't be added.
- From the GUI. This merits a little further explanation.
Add code from the GUI
First, copy some code into your workspace. For this simple example, Windows Explorer will suffice.
Once you've copied the code, if you'd like to get the entire tree under source control, simply right-click on the root of the workspace and select "Add directory tree to source control". This is the same thing you did at the beginning of this chapter with command line "cm add -R ." plus "cm ci". It adds your code and checks it in for you in one step.
If you go to the branch explorer, now you'll see how you have a new changeset created. This is the one you've just created when you added your code.
Selecting what to add: ignoring files and directories
Let's go back to the first step. Suppose you have contents on your directory that you simply want to skip. For instance, you don't want to add your "bin" directory under source control. How can you do that? Check the following screenshot. It explains how to ignore a directory. The same can be applied for files too.
Please note that there are two options:
- The first one just says "bin" which means: ignore any "bin" directory. So if you want to ignore all of them in your tree, that's the one to use.
- The second one means: just ignore this EXACT "bin" directory (the one on the root of the workspace according to the screenshot). Any other "bin" down in the code tree won't be ignored.
Note: By doing this, you're actually editing the ignored.conf configuration file, which is always local. Don't worry if you set up something weird, it will only affect your machine, not the repository.