Revision Control System

By now you have created and edited several files. To store them securely and share them with your team, you are advised to use a revision control system. Financial Model Builder has integrated support for Git.

In this lesson you will learn how to configure your project to work with GitHub, a Git-based platform for centralized storing and sharing of your code. However, a complete coverage of Git or GitHub is out of the scope of this tutorial. You are advised to read the Git and GitHub documentation.

Initialize Project

To initialize your project as a git repository
  1. Select your project from the Project Explorer.
  2. From the Git menu, select Initialize Repository. A confirmation message is displayed on the Log area.
Fig. 133: Initializing a project as a git repository.

Fig. 133: Initializing a project as a git repository.

To configure the committer for the repository
  1. From the Profile menu, select Preferences.
  2. On the Git section, select Commiter.
  3. Enter your name and email address as you are the user that will commit to your repository. This information helps git assign each commit to a real person.

Commit Local Changes

To commit the source files
  1. From the Git menu, select Commit. The list of files that were changed from the last commit is displayed. In the case of the first commit, all project files are displayed.
  2. (Optional) Unselect files that you want to exclude from this commit.
  3. In the text area, below the file list, enter your commit message. This is mandatory to enable the Commit button.
Fig. 134: Adding the files to a git commit.

Fig. 134: Adding the files to a git commit.

  1. Click Commit. Your changes are committted to the git repository and safely stored in its history in the master branch. A confirmation message is displayed in the Log area.
Fig. 135: A successful commit in a git repository.

Fig. 135: A successful commit in a git repository.

Configure GitHub

In order to use GitHub, you must create a pair of SSH keys that will secure the transfer of the local files to the remote GitHub repository.

To create the SSH keys
  1. From the Profile menu, select Preferences.
  2. From the SSH tab, select VCS.
  3. Click Generate Key.
  4. Enter the host-name of GitHub: github.com and click OK. The pair of SSH keys is created, and the public key is listed. You can use this pair to transfer files only to and from github.com.
  5. Click View on the line of the public key that you just created.
Fig. 136: Create a pair of SSH keys to use with github.com.

Fig. 136: Create a pair of SSH keys to use with github.com.

  1. Use the public key string to store it in your GitHub repository. For more details, see github documentation. After you registered your key with your GitHub account, you can push and pull data from your GitHub remote repository.
To add the remote git repository
  1. On your GitHub account, go to your repository. If you don’t have one, create, or otherwise, make sure you have access to a repository. This is the remote repository that you will use to push your changes from Financial Model Builder.
  2. Find the SSH URL to clone your remote repository. Usually, it has the following form: git@github.com:<github-account>/<github-repository-name>.git
  3. In Financial Model Builder, from the Git menu, select Remotes > Remotes.
  4. Click Add to add the GitHub repository as a remote repository for your project.
  5. Enter the name: use origin by convention.
  6. Enter the SSH URL of your GitHub repository.
Fig. 137: Add the github.com remote repository to your project.

Fig. 137: Add the github.com remote repository to your project.

Push to GitHub Repository

To push your changes to the remote GitHub repository
  1. From the Git menu, select Remotes > Push.
  2. Click Push. Your local git history is now pushed and synchronized to the remote’s GitHub history. A confirmation message is displayed in the Log area.
Fig. 138: Changes successfully pushed to the remote GitHub repository.

Fig. 138: Changes successfully pushed to the remote GitHub repository.