-
Marie-Gabrielle Dondon authoredMarie-Gabrielle Dondon authored
Using Git from RStudio
Table of Contents
To begin
If you have never used git with RStudio, we strongly advise that you follow our tutorial on using git from RStudio (/”RStudio et Gitlab”/ ). Before proceeding, make sure you also have followed the “git/GitLab configuration” tutorial.
Alternatively, you may want to watch this video (in English). If you do not like videos, you should have a look at the step-by-step explanations from Software Carpentry. It comes with many screenshots and is quite progressive.
Cloning a repository
Open RStudio and do the following steps:
- Create a new version controled project:
File / New Project / Version Control
- Get the URL from your GitLab repository:
- Indicate this URL in the “Repository URL” field (you may want to
prefix this URL with =xxx@= where =xxx= is your Gitlab id to avoid
repeatedly giving it later on).
- If you’re behind a proxy, git should be configured accordingly. Check the “Dealing with proxies” section.
- Git will then connect to Gitlab and fetch a whole copy of the repository.
- RStudio should restart in a mode related to Git:
- The file manager on the right, allows you to browse the version controled repository.
Modifying a file
- Open
Module2/exo1/toy_document.Rmd
and perform a simple modification. - Save
- Go to the Git menu to commit
- Select the lines to commit and then click on
commit
Your modifications have now been commited on your local machine. They haven’t been propagated to GitLab yet.
- Click on
push
to propagate them on GitLabNB: You won’t be able to propagate your modifications on GitLab if some modifications have been done on GitLab in the meantime.
- You should first merge these remote modifications locally. Click on
pull
to get these modifications on your machine.The video Let’s demystify Git, Github, Gitlab/Working together explains how to handle conflict with Git.