These guidelines explain the different steps to be taken when collaborating in a Github repository while developing code in RStudio. The main aim is to give a concise overview rather than giving detailed information on different options or showing screenshots for each step. The steps presented here follow more or less this schedule but the explanations and tips are rather complementary.
Ask for changes or propose to make changes in a Github repository:
Issues can be used to:
Issues can be:
(If you don’t have the project locally, check the manual here.)
In RStudio on the
main branch is active and up to date (
New Branch (hit button) and give it an informative name
Commit for every change
Push your changes to the repository on github (at least once a day, not too frequently as every push might trigger automated tests)
Create a pull request when your work is ready to share with collaborators.
In RStudio, make sure all changes are committed and pushed.
In the GitHub repository:
Compare & pull request button that appears after recent pushes
New pull request button
Create Pull request
Remark: after creating a pull request, it is still possible to add new commits to this branch and pull request. After pushing new commits in RStudio, they appear in the pull request. To show others that you are not finished yet, you can convert the pull request to draft (right top of page, where you request reviewers)
Reviewers will receive an email with a link to the pull request, and they can:
Pull and select the branch name (mentioned at the top of the pull request in GitHub)
During this revision, in the Pull request on GitHub:
Commit suggestions (easiest in
files change tab)
Once you and your coworkers agreed on the final version in your branch, it can be merged to the main branch:
More and choose
git merge main (or replace main by the name of the branch you want to merge to your branch)
code in your active branch
code in the main branch
Push all new commits to GitHub
Merge pull request
Delete branch to keep your repo clean and clear
For screenshots, see here.
When merging to the main branch or another important branch in the repo, always do this on GitHub by using a pull request. It is recommended to protect these branches to enforce this procedure.
Once you are satisfied with a version, you can create a release.
After deleting branches on the remote, you may want to get rid of them as well in the selection list in the git pane in RStudio. It is done automatically after following these configuration steps once. But it can also be done manually:
More on the
Git tab and choose
git fetch -p to remove branches that don’t exist anymore on the origin
git branch -d <branch name> to remove local branch
<branch name> (branches that are merged can be listed with
git branch --merged)