Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Rstudio addin for version control and assignment management using git

NotificationsYou must be signed in to change notification settings

vnijs/gitgadget

Repository files navigation

gitgadget is an R-studio addin for version control and assignment management using git. The assignment management functions currently support theGitLab API. PRs for use with GitHub are welcome. For alternative that uses GitHub seehttps://github.com/rundel/ghclass although this does not (currently) have a shiny user interface.

gitgadget is not intended as a tool for all-things-git. For that you need something likegitkraken.gitgadget provides a few additional features not (yet) available in R-studio that can be useful to students and faculty using git for classes. For an excellent discussion of this level of functionality seehappy git with R andtalk about version control by Jenny Bryan andgit for humans by Alice Bartlett.

gitgadget requires Rstudio version 1.2 or later. Please use theissue tracker on GitHub to suggest enhancements or report problems. To install the latest version ofgitgadget use the command below:

install.packages("gitgadget",repos="https://radiant-rstats.github.io/minicran/")

To startgitgadget click on the Addins menu in Rstudio and then ongitgadget.

On macOS, you will you will need to run the command below from a terminal to get access to git commands:

xcode-select --install;

On Windows you will need to install git bash fromhttps://git-scm.com/download/win.

Note: Hover over any button in thegitgadget application for additional information about what clicking the button will accomplish

Introduce

To start using git andgitgadget firstintroduce yourself to git. Set a global user name and email for git (e.g., your GitLab user name and email). By default,gitgadget will try to turn on an appropriate credential helper for your operating system. Seehttps://happygitwithr.com/https-pat.html for additional information.

Unless you plan to usegitgadget to manage student assignments, selectstudent as theUser type. Finally, enter the main directory where you plan to clone code repos (e.g., "C:/Users/me/git")

Note: On Windows we recommend cloning and creating repos using HTTPS rather than SSH

Note: As of version 0.7.0 the default branch has been set to 'main'

Setup for git and gitlab

https://youtu.be/FQx_3EDQaXc

Individual assignment practice

https://youtu.be/CANV6-mfZ9I

Merge conflicts

https://youtu.be/elq5UUG0RbE

Group assignment practice

https://youtu.be/uwqUHl3z37o

Note: In these videos we use a docker container (seehttps://github.com/radiant-rstats/docker/tree/master/install/) but this is not required

Create (GitLab only)

Enter the path to a local directory to create a repo on GitLab. If the local directory does not yet exist it will be created. You can also click theOpen button and navigate to an existing directory. If aGroup name is provided it will be used to place the repo on GitLab. This is recommended if you are usinggitgadget for assignment management. If left blank, the GitLab user name will be used as the group. APrefix can be added and will default to the value ofgit.prefix in .Renviron (seeInitial settings below). The prefix can be used to avoid conflicting assignment names across classes (e.g., multiple classes using "assignment1").

If you selectedfaculty as theUser type in theIntroduce tab you will have the option to upload a CSV file with student tokens (see below). If a user file is provided, a radio button will be shown that can be used to indicate if the work should be completed individually or in teams. Furthermore, you can choose if you want tohide orshow the main class repo to students.Hiding the main repo can avoid confusion where a student might accidentally clone the wrong repo (i.e., the class repo rather than their own fork) and not be able to push there changes back to gitlab.Showing the main repo, on the other hand, will make it possible tosync any changes to the class repo after it was forked for each student.

If a CSV file with TA information is specified they will be added as "Maintainer" to the class repo. The will also be added as "Maintainer" to all created student (or team) forks. TA information should includeuserid,token, andemail.

Clone

Clone a repo from GitLab (or GitHub) (e.g.,git@gitlab.com:username/test-repo.git). The name for the directory placed insideBase directory to clone repo into will be taken from the repo name unless aCustom directory to clone repo into is provided. If there is no R-studio project file (.Rproj) in the remote repo, one will be created.

Note: To use an SSH key with GitGadget you should clone from a terminal the first time. See the video linked above (Setup for git and gitlab) for a demo. As mentioned above, for Windows users we recommend using HTTPS to clone and create repos.

Note: To activate an HTTPS credential helper the first time you clone a repo from GitHub or GitLab you will be asked to provide your username and password in the Rstudio terminal

Branch

Create a local branch from the active branch by providing a name for the new branch and clickingCreate local. Link and push to the (GitLab) remote by clicking theLink remote button. If remote branches exist click theCheck out button to work with a branch locally. If branches other thanmain exist you canMerge branches or delete them if they are no longer needed. To undo a merge-in-progress, e.g., with merge conflicts, click theAbort merge button.Unlink remote will not remove the local or the remote branch but only the link to the remote (i.e., the push/pull arrows in R-studio will gray-out).

Note: Changes to the list of available branches may only be visible in R-studio after clicking therefresh button in the Git tab.

Sync

To commit changes to the local copy of your repo provide aCommit message and then click theCommit button. If you committed changes you are not sure about, theUndo button will let you revert the latest commit (after confirmation).

If the remote repo contains changes you do not yet have locally press thePull button. To add committed local changes to the remote repo, click thePush button. It you completely broke the local repo and want to start over with a clean copy of the remote repo, press theReset button.

If the repo you are working on is a fork you probably want to make sure it is up to date and merge any changes into the version you are working on locally. The first step is to ensure that git knows about the upstream repo you forked from. Copy the SSH or HTTPS link to clone the original repo into theSync repo with remote it was forked from input in theSync tab and then pressSync. The repo you forked will now be added as aremote. ClickMerge to update your local copy of the repo with any changes to the original remote repo. Fix merge conflicts, if any, and proceed to work on the local repo. To undo a merge with merge conflicts click theAbort merge button. Click theUnlink to remove the reference to the upstream repo you forked from.

Collect (GitLab only)

Collect assignments from students/teams using Merge Requests (MR) on GitLab. Inputs will only be shown if the user type in theIntroduce tab is set tofaculty.

If a CSV file with TA information is specified they removed from (Hide) or added to (Show) to all created student (or team) forks as a "Maintainer". TA information should includeuserid,token, andemail.

To collect and fetch assignments linked to class repo you must first open a clone of that repo in Rstudio and provide yourToken. TheAssignment name input should now show the assignment repo name on gitlab.com. Next, indicate of the assignment wasindividual orteam and click theCollect button to generate Merge Requests for all students (or team leads). Once this step is completed you can review and comment on the MRs using the GitLab UI. Collecting assignments requires that MRs be generated, which in turn requires that the class repo be visible to students. TheHide button can be used to ensure students will not have access to the MRs. However, since this is likely to be after the assignment due data, visibility of the class repo and MRs may not be or much concern. TheShow button will provide students access to the class repo and MRs.

To view, run, and edit the MRs locally, press theFetch button. After fetching all MRs they are converted to branches using the student-id as the branch name and pushed back up to the server. Switch between branches to test code and provide comments and/or fixes. Use the Git tab in R-studio or theSync tab ingitgadget to push local changes to the remote branch. Notify students of the comments/fixes by providing a link to the branch in the comments on the original MR.

If students update their assignment repo these changes will be visible in the MRs as long as the class repo is visible to students (click theShow button to ensure access). If you want toFetch these updates for local review you should first delete the existing branches for one or more students. This can be done through theBranch tab by selecting all branches you want to delete and clicking theDelete local button. Then click theFetch button in theCollect tab again to obtain the latest version.

Assignment management

Key functions ingit.R that can be accessed through thegitgadget interface are:

create_group(...)

Used to create a group for a course. TheGroup name variable should be set to something like "school-courseid-year". This creates the group and adds students as, for example,reporters with read-only access on GitLab. Make sure to specify avalid permission number.

create_repo(...)

To create an assignment repo setLocal directory to the directory with the assignment files. APrefix could be added to avoid conflicts across courses that might use the same assignment name (e.g., assignment1). Access this functionality through theCreate tab ingitgadget.

assign_work(...)

Forks the assignment repo uploaded by a faculty member or TA for each student/team and creates the appropriate groups for team work. This requires a csv file with the structure shown below, including the students' (GitLab) private token.

useridteamemailtoken
id1team1student1@gmail.compx.......
id2team1student2@gmail.comn9.......
id3team2student3@gmail.comVR.......

collect_work(...)

Generates Merge Requests for all students or teams. Requires a csv file with the structure shown above.

fetch_work(...)

Fetch Merge Requests for all students or teams from the GitLab server. After fetching all MRs they are converted to branches using the student-id as the branch name and pushed back up to the server. Switch between branches to test code and provide comments. Push to update the remote branch with the local changes.

Initial settings

GitGadget supports the following input from an .Renviron file (e.g., "C:/Users/me/.Renviron"). The easiest way to view.Renviron is to click on theCheck button in theIntroduce tab or useusethis::edit_r_environ().

git.user ="your-gitlab-id"git.email ="youremail@ucsd.edu"git.token ="abc123"git.home ="~/git"git.server ="https://gitlab.com/api/v4/"git.group ="school-courseid-2019"git.prefix ="school-courseid-2019-"git.userfile ="path-to-user-file.csv"git.tafile ="path-to-ta-file.csv"git.user.type ="faculty"

About

Rstudio addin for version control and assignment management using git

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp