June 3, 2016
Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later. Every change made to the source is tracked, along with who made the change, why they made it, and references to problems fixed, or enhancements introduced, by the change. Spacedecode’s implementation of version control is compatible with Git.
Before we get started, please note that version control operations are executed on per-object basis which means that committing changes on the project level does not affect the vessel changes. Also, pushing vessel changes does not automatically push project changes. Everything you do on the project level must also be done on the vessel level seperately.
The lifecycle of the status of your files1.
You can do this in two ways, on the commandline or on the GUI. To check-in changes on the commandline first check if there are available changes to be checked in:
spaced project changes namespace/helloworld
You may use the Project TAG or ID to list changes. Viewing project changes will also display vessel changes, which you have to check-in seperately. This is how changes are displayed on the commandline:
For changes to be added to version control, you need to check them in using the
add command. Spacedecode allows you to add changes individually or as a group. To add individual changes you have to specify each file as shown below:
spaced project add spacedecode/public path/to/file
To add all changes at once all you have to do is include a period instead of the actual file:
spaced project add namespace/helloworld
Now that all the changes have been added, run
spaced project changes... to check if all the changes were added successfully. Added changes will appear in green as shown:
Committing changes is a way of labeling them so that other people who get to work on the project know why the file was changed. Remember that if you checked-in changes individually you have to commit the individually. Let’s commit the changes we have added:
Note: Don’t worry that you didn’t make the changes yourself. The file
project.ymlgets updated when a vessel is created inside the project.
To commit changes run this command
spaced project commit namespace/helloworld -m "Updated website content"
Once you have committed changes, your team will know what changed and who made the changes.
Important! As mentioned previously you have to check the vessel changes separately. See if you can follow the same version control process and Add and Commit vessel changes as well. To view the vessel changes, run this command:
spaced vessel changes <vessel ID>
Sharing is caring
At this point, both your project and the vessel must be in clean state, meaning that there are not uncommitted changes.
On this section we look at how to share our project with people in our team. This process is actually part of version control. We refer to it as pushing changes.
To push changes is simple, on your commandline just the command below, if it goes well you will get a message like this one
Pushing project....Changes pushed successfully:
spaced project push namespace/helloworld
Do the same for your vessel
spaced vessel push <vessel name>
Note: Please note that changes will be pushed to the currently selected environment. We advice you to check which environment is active on the GUI.
When all this is done successfully, changes will be pushed to spacedecode.com, and your team will see all your commits from there. All they have to do is access the project and navigate to the Work tab: