Version control through Git

Version control is available in a workspace through the use of Git from the Built-in Apps.

The Git function will create a Git repository that can cover all the files in that entire workspace and can be used by all members of that workspace. You can also use Git through Gitea from a Virtual Machine.

Creating a Git repository

A repository can be created either through the terminal in RStudio or Jupyter Notebook, or through the user interface within RStudio.

To use the terminal in Jupyter Notebook, open the App and go to new> terminal

Run the command

git init

JN terminal init.PNG

This creates a repo for that workspace.

To use the terminal in RStudio, open the App and go to the tab named terminal

Run the command

git init 

rstudio terminal init.PNG

This creates a repo for that workspace.

To use the interface within RStudio, open the App go to File> New Project> New Directory> New Project and tick the option “Create a Git repository” before clicking on Create Project.

rstudio new project creation.PNG

This creates a new project with a Git repository inside it.

If you have already created a project but did not create a Git repository when it was created, go to Tools> Version control> Project setup and change the Version control system to Git.

rstudio git setting.PNG

Please note that due to a known issue within RStudio, the webpage needs to be refreshed when switching to a project in order for it to load.

Using Git

To use Git within RStudio, you can either use the CLI commands in the terminal that will be familiar to Git users or the UI options that you can find under Tools>Version Control to either do a commit or see the Git history.

To use the terminal, use the following commands:

git add <file>

git commit – m “commit message”

rstudio ui commit.PNG

To use Git within Jupyter Notebook run the Git commands in the terminal:

git add <file>

git commit – m “commit message”

If the active branch of the repository is changed, it will be changed for all users of a workspace. Please keep that in mind if multiple people are working on a project at the same time. Full information about the features of Git itself can be found here.

Identities

In order to keep track of who has done the different commits to the Git repository, each commit will be marked with the name and email address of the person who did it.

This is a global setting for all users of the App within that workspace. Please note that if the local identity information is changed, that will override the global setting and every user in that workspace will get the same local identity. This will limit the ability to be able to tell who made the different commits, so we recommend that no change to the identity information is done.

Updated on December 21, 2022

Was this article helpful?